Sommaire

BONJOUR
Musique "Invention BWV784" J.S. BACH 1685-1750

Tutoriel et Help

Resource - RES

Nous veillons aux respects des droits d'auteur : si par erreur un contenu protégé est disponible sans indication sur ce site, merci de contacter l'administrateur, il sera retiré ou mis à jour dans les plus brefs délais.


Vu dans ... https://chgi.developpez.com/windows/ressources/

7 - Les ressources.

I. Introduction :▲

Dans ce chapitre nous allons aborder les ressources.

Tout d'abord qu'appelle t'on les ressources dans un programme Windows ?

Ce sont des données de toutes natures qui sont incorporées à l'exécutable. Cela peut être des images, des icônes, des chaînes de caractères, des blocs de données de toutes sortes... Mais aussi des boîtes de dialogue et des menus qui seront construits à partir de script.

Image non disponible

II. Incorporation des ressources à l'exécutable :▲

L'incorporation des ressources à l'exécutable est réalisée par le linker. Nous devons lui fournir un fichier contenant les ressources. Ces fichiers ont l'extension ".res". Ils sont compilés par un compilateur de ressources, auquel on fourni un fichier de script de ressources. Les fichiers de script de ressources sont des fichiers texte ayant l'extension ".rc". Il existe aussi des éditeurs de ressources permettant de créer visuellement les fichiers ressources.

Ce tutoriel n'étant pas déstiné à des outils particuliés, nous utiliserons uniquement les scripts de ressources dans les exemples qui vont suivre.

Si vous utilisez un EDI, il suffit d'ajouter les scripts de ressources au projet (pour Dev-C++ il faut les ajouter par le menu "Projects" puis "Projects Options" puis par le bouton "Load Resource", pour C++ Builder il faut tout simplement ajouter les fichiers au projet). La compilation des ressources sera dans ce cas transparente.

Nous allons en voir deux dans ce chapitre : les icônes et les menus.

III. Le script de ressources :▲

Nous allons rependre l'exemple du chapitre 3 - Les commandes et notifications. Nous allons d'abord ajouter des icônes dans les ressources de l'exécutable. Créons tout d'abord un fichier script de ressources nommé "resource.rc" avec le texte suivant :

1.
2.
1 ICON icone.ico
2 ICON autre.ico

Chaque ligne est composée de trois éléments, le premier est un identificateur, le second le type de ressource (ICON pour une icône dans l'exemple) le dernier est le contenu, dans le cas de l'exemple ce sera le contenu d'un fichier. Ils doivent bien sur exister. Les ayant mit dans le même dossier que les fichiers sources du programme, je n'ai pas indiqué le chemin pour les localiser. S'ils se trouvent ailleurs il faudra bien sur mettre le chemin (j'ai du tout de même le mettre pour la compilation avec Dev-C++ malgré qu'ils se trouvaient dans le même dossier).

Certain compilateur de resources demande d'inclure les fichiers entêtes de Windows qui contiennent la définition des identificateurs utilisés dans le fichier script de ressources.

Il peux y avoir des différences notables entre les différents compilateurs de ressources. Je vous invite à consulter l'aide de celui que vous utilisez si vous rencontrez des problèmes de compilation.

Je le répète une dernière fois, ce fichier devra être ajouté au projet si vous possédez un EDI ou compilé à l'aide d'un compilateur de ressources et lié à l'exécutable si vous n'avez pas d'EDI.

A ce stade, si vous compilez et que vous visualisez le fichier exécutable dans l'explorateur de fichiers, il devrait avoir la première icône de la liste (ce n'est pas forcement vrai si vous utilisez un EDI, ils peuvent ajouter automatiquement une icône aux ressources de l'exécutable).

Nous allons maintenant mettre la deuxième icône comme icône de la fenêtre (celle qui ce trouve à gauche sur la barre de titre) :

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance,
                                                LPSTR lpCmdLine, int nCmdShow)
{
    WNDCLASS wc;

    wc.style = 0 ;
    wc.lpfnWndProc = MainWndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = NULL;
    wc.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(2));
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = NULL;
    wc.lpszMenuName =  "MyMenu";
    wc.lpszClassName = "MaWinClass";

    if(!RegisterClass(&wc)) return FALSE;

Pour cela on affecte le champ hIcon de la classe de fenêtre avec une icône que l'on charge avec la fonction LoadIcon. Elle reçoit comme paramètre le handle d'instance de l'application, pour son second paramètre elle attend un pointeur sur une chaîne de caractères identifiant l'icône. Dans le script de ressource nous l'avons identifié avec une valeur numérique. C'est avec la macro MAKEINTRESOURCE que nous faions cette conversion.

Nous aurions pu les identifier avec des valeurs littérales :

1.
2.
ICONE1 ICON icone.ico
ICONE2 ICON autre.ico

Dans ce cas LoadIcon aurait reçu un pointeur sur la chaîne de caractère identifiant l'icône dans son second paramètre.

1.
     wc.hIcon = LoadIcon(hinstance,"ICONE2");

IV. Ressources de type menu :▲

Toujours avec le même exemple, nous allons supprimer le menu que l'on avait créé par programme au chapitre 3 et le créer avec un script de ressources :

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
LEMENU MENU
BEGIN
  POPUP "Fichier"
    BEGIN
       MENUITEM "&Nouveau", IDM_NEW
       MENUITEM SEPARATOR
       MENUITEM "&Quitter", IDM_QUIT
    END
  POPUP "Aide"
    BEGIN
       MENUITEM "A propos...", IDM_ABOUT
    END
END

Nous retrouvons là aussi nos trois éléments : l'identificateur de la ressource (littérale dans cet exemple), suivi de son type (MENU : barre de menu) puis de son contenu. Ici le contenu n'est pas un fichier, mais un script de construction de barre de menu, balisé par les mots BEGIN et END. Elle possède deux sous menu (POPUP : menu déroulant) "fichier" et "Aide". Le premier possède trois options (MENUITEM) "&Nouveau", SEPARATOR et "&Quitter". La liste des options d'un sous menu est aussi balisée par les mots BEGIN et END. Chaque option doit être identifiée par une constante numérique. Cette constante sera envoyée à la procédure de fenêtre quand l'option du menu sera actionnée. Il est préférable de les nommer pour plus de clarté dans le code. Comme elles devront être connues du script de ressource et du fichier source du programme, nous les définissons dans un fichier entête séparé, nommé dans cet exemple "resource.h" :

1.
2.
3.
#define IDM_QUIT  1
#define IDM_NEW   2
#define IDM_ABOUT 3

Ce fichier devra donc être inclut dans le fichier source et dans le fichier script de ressource (voir code à la fin de ce document). Le menu sera ensuite affecté à la classe de fenêtre. Ceci en affectant au champ lpszMenuName de la classe de fenêtre, un pointeur sur une chaîne de caractères contenant le nom litéral du menu :

1.
    wc.lpszMenuName =  "LEMENU";

C'est tout pour sa construction. La récupération des actions du menu ce fait sur réception des messages WM_COMMAND de la même manière qu'au chapitre 3 :

1.
2.
3.
4.
5.
    switch (uMsg)
    {
        case WM_COMMAND:
            if(LOWORD(wParam) == IDM_QUIT) PostMessage(hwnd, WM_CLOSE,0,0);
            /*...         */

Vous avez du remarquer que j'ai mis le caractère '&' dans le texte des options de menu "&Nouveau" et "&Quitter". Ce signe sert à souligner le caractère qui le suit et à donner la possibilité d'activer l'option correspondante avec la touche du clavier correspondant à ce caractère. Ceci uniquement quand le popup menu est ouvert. A ne pas confondre avec les accélérateurs clavier que l'on verra lors d'un chapitre ultérieur.

Nous aurons l'occasion de revenir sur les différents types de ressources au cours des chapitres suivants.

V. Code complet :▲

V-A. resource.h :▲

1.
2.
3.
#define IDM_QUIT  1
#define IDM_NEW   2
#define IDM_ABOUT 3

V-B. resource.rc :▲

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
#include <windows.h>

#include "resource.h"

1 ICON icone.ico
2 ICON autre.ico

LEMENU MENU
BEGIN
  POPUP "Fichier"
    BEGIN
       MENUITEM "&Nouveau", IDM_NEW
       MENUITEM SEPARATOR
       MENUITEM "&Quitter", IDM_QUIT
    END
  POPUP "Aide"
    BEGIN
       MENUITEM "A propos...", IDM_ABOUT
    END
END

V-C. winmain.c :▲

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
#include <windows.h>

#include "resource.h"

HINSTANCE hinst;

LRESULT CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM);

int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance,
                                                LPSTR lpCmdLine, int nCmdShow)
{
    HWND hwnd;
    MSG msg;
    WNDCLASS wc;

    hinst = hinstance;

    wc.style = 0 ;
    wc.lpfnWndProc = MainWndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hinstance;
    wc.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(2));
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = NULL;
    wc.lpszMenuName =  "LEMENU";
    wc.lpszClassName = "MaWinClass";

    if(!RegisterClass(&wc)) return FALSE;

    hwnd = CreateWindow("MaWinClass", "Titre", WS_OVERLAPPEDWINDOW,
                                   CW_USEDEFAULT, CW_USEDEFAULT, 400, 300,
                                                   NULL, NULL, hinstance, NULL);
    if (!hwnd)  return FALSE;

    ShowWindow(hwnd, nCmdShow);

    while (GetMessage(&msg, NULL, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    return msg.wParam;
}
/******************************************************************************/

LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    static HWND hEdit;
    static BOOL EditNotChg = TRUE;
    switch (uMsg)
    {
        case WM_CREATE:
            {
             HFONT hFont;
             hEdit = CreateWindow("edit", "Texte",
               WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL,
                                            0, 0, 0, 0, hwnd, NULL, hinst, NULL);
             hFont = (HFONT)GetStockObject(ANSI_FIXED_FONT);
             SendMessage(hEdit,WM_SETFONT,(UINT)hFont,TRUE);
             SendMessage(hEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN,
                                                                MAKELONG(5, 5));
             return 0;
            }

        case WM_CLOSE:
            if(EditNotChg ||
               MessageBox(hwnd,"Le texte a été modifié.\r\nEtes vous sûr de \
vouloir fermer l'application ?"
                           ,"Question ?",MB_YESNO | MB_ICONQUESTION ) == IDYES)
                                                            DestroyWindow(hwnd);
            return 0;

        case WM_COMMAND:
            if(LOWORD(wParam) == IDM_QUIT) PostMessage(hwnd, WM_CLOSE,0,0);

            if(LOWORD(wParam) == IDM_NEW)
                if(EditNotChg ||
                  MessageBox(hwnd,"Le texte a été modifié.\r\nEtes vous sûr de \
vouloir fermer votre travail ?"
                            ,"Question ?",MB_YESNO | MB_ICONQUESTION ) == IDYES)
                      {
                              SendMessage(hEdit,WM_SETTEXT,0,(long)"");
                              EditNotChg = TRUE;
                      }

            if(LOWORD(wParam) == IDM_ABOUT)
                     MessageBox(hwnd,"Mon beau programme !","A propos !",MB_OK);

            if(HIWORD(wParam) == EN_CHANGE) EditNotChg = FALSE;

            return 0;

        case WM_SIZE:
             MoveWindow(hEdit, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
             return 0;

        case WM_DESTROY:
            PostQuitMessage(0);
            return 0;

        default:
            return DefWindowProc(hwnd, uMsg, wParam, lParam);
    }
}


Windows Programming/Resource Script Reference - Wikibooks, open books for an open world

Vu dans ... https://en.wikibooks.org/wiki/Windows_Programming/Resource_Script_Reference

General construction

Resource script files are human-readable text files in either ANSI or Unicode (more strictly: UTF-16 with byte order mark (BOM)) format. To intermix different languages in ANSI format, a quirks #pragma exist to switch the code page in between. Unicode, #pragma switch, and the LANGUAGE statement are only supported for Win32.

A typical small file may look like

#include <windows.h>
#define IDC_STATIC -1

100 ICON "ProgIcon.ico"

10 MENU
{		// or BEGIN
 POPUP "&File"
 {
  MENUITEM "&Exit",IDCANCEL
 }
}		// or END

Using curly braces or BEGIN/END depends on your preference. The old, space-wasting style is the BEGIN/END pair, coming from the Pascal heritage of MacOS and Win16 API calls. C programmers typically prefer curly braces. The Visual Studio Resource Editor always generates BEGIN/END pairs, besides lots of housekeeping stuff.

Beginning with some header inclusion and #define statements, every resource is included as either

id_of_resource  resource_type  [memory management flags]  "filename"

or

id_of_resource  resource_type  [memory management flags]
BEGIN
 subsequent data
END

An exception from this rule is

  • The LANGUAGE statement, can be placed almost everywhere (Win32 only)
  • The DIALOG and the VERSIONINFO resource, there are additional statements between heading line and BEGIN
  • The STRINGTABLE resource, where no resource ID is before the keyword. Instead, every string is prefixed with an ID

id_of_resource and resource_type can be either a string or a number. No quotes are there! A number is the preferred method for identification. All predefined resource types are numbers. But watch out! If you use an unknown ID for the resource compiler (let's say MANIFEST for Visual Studio 6), you will get neither error nor warning, and the resource is built with string resource type. Windows XP, using ExecProcess(), will not find that intended manifest and your program will show up in old visual style.

Conditional compilation with #if / #ifdef / #endif is also supported.

Expressions for IDs are limited to very simple math, no boolean operators are permitted.

Under the hood

Resources are compiled into a three-level directory structure:

  1. Resource type (MENU, DIALOG etc.)
  2. Resource ID (the number that is ahead the Resource Type – for STRINGTABLE, the ID of a group of upto 16 strings)
  3. Resource language (the currently active language, given by command-line option or LANGUAGE statement; Win32 only)

The content of following data depends on actual resource type. Mostly, it's binary.

Read access to the binary data of an arbitrary resource is done with

FindResource()		// get a handle
LoadResource()		// get the binary size
LockResource()		// get a pointer; Win32: This is a simple macro, Win16: This is a function call.
…			// do something
UnlockResource()	// Win32: This is a do-nothing macro, Win16: This is a function call.
FreeResource()		// release

Because bitmap, icon, cursor, dialog, string table, and menu resources are not officially documented and a bit hard to parse, programmers should use specialized resource load functions for these resource types instead. See description and examples for these types below.

Identifiers

Identifiers are generally named in a certain way, although the reader and all programmers are free to alter this naming scheme. It is simply a suggestion. Identifiers generally start with the prefix "ID", followed by a letter that denotes the type of identifier:

  • IDS: A string resource
  • IDM: A menu resource
  • IDC: A command identifier
  • IDD: A dialog box resource
  • IDA: An Accelerator table resource
  • IDI: An Icon or bitmap resource
  • IDB: A Bitmap resource
  • ID: A custom resource, or an uncommon resource type.

Sometimes, the command identifiers in a menu are given an "IDM_" prefix, to distinguish between commands from other sources.

There is no need to use symbolic identifiers. In some cases, identifiers complicate access to numerically adjanced controls in a dialog or menu. In any case, identifiers don't help non-English programmers to read a software source. Numbers never need translation. And both identifiers and numbers need explanation.

IDs are allowed in range 0..65535 and preferred in range 1..32767.

LANGUAGE

This keyword has different scope:

  • Local (for one resource) if located below the resource line, like
21 MENU
LANGUAGE 7,1 // or, LANG_GERMAN, SUBLANG_GERMAN
{
 POPUP "&Datei"  // = "&File"
 …

This language applies to that menu

  • Global (for all next resources) if located somewhere else

Language-neutral resources, like culture-free icons, VersionInfo, and Manifests, should be always set to LANGUAGE 0,0 (or, more verbously, LANG_NETUTRAL,SUBLANG_NEUTRAL).

Note to always check images against culture dependency! A typical mistake is the plug symbol for a mains-supplied notebook: It shows undoubtly an American plug, even in Europe. Obviously, images containing letters or text are culture-dependent.

Memory Management Flags

There are some Memory Management Flags from Win16 heritage, like MOVEABLE, FIXED, etc. See LocalAlloc() for some flags.

DISCARDABLE

Resources are loaded into memory when the program is run. However, if a resource is not in use, and if Windows does not need them immediately, resources can be optionally unloaded from memory until needed. To specify that it is okay to unload an unused resource from memory, you may list the DISCARDABLE keyword with the resource. DISCARDABLE resources allow more efficient memory usage, but can slow down your program if they need to be loaded from disk.

The DISCARDABLE keyword is ignored for 32-bit Windows, but remains for compatibility. 32 bit resources are never loaded but mapped into memory.

Icons

Icons can be stored in a resource file using the ICON keyword. Here is a general example of using an icon in a resource script:

IDI_ICON<n> ICON [DISCARDABLE] "iconfile.ico"

Windows Explorer will display the binary executable with the first icon from the script. For instance, if we load two icons, as such:

IDI_ICON1 ICON DISCARDABLE "icon1.ico"
IDI_ICON2 ICON DISCARDABLE "icon2.ico"

And we define our macros as such in the corresponding resource.h:

#define IDI_ICON1 1
#define IDI_ICON2 2

The executable file will have icon1.ico as its icon.

To load an icon from an executable module, assuming we have an instance handle to the module (hInst in the following example), we can get a handle to the icon as such:

HICON hIcon;
hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON1));

This will return a handle to the icon associated with the identifier "IDI_ICON1". Icon identifiers are generally prefixed with an "IDI_" which is short for "ID for an Icon".

The second parameter to the LoadIcon() function is a pointer to a string. String pointers are 32 bit values. However, if the most significant 16 bits are all zero, Windows will treat the value as a resource number, and not a string. To make the conversion between a string and a 16-bit integer, Microsoft provides the MAKEINTRESOURCE macro. Similarly, we could have used a string to define our Icon:

MYICON1 ICON DISCARDABLE "icon1.ico"

And we could load this string by name:

HICON hIcon;
hIcon = LoadIcon(hInst, "MYICON1");

String identifiers for resources are case insensitive.

WNDCLASSEX has handle values for two icons: a large icon and a small icon. The small icon is the icon used in the upper-left corner. Small icons are generally 16 pixels square. Larger icons are 32 pixels square. If no small icon handle is provided, the large icon will be shrunk down to fit.

If the LoadIcon() function is supplied with a NULL instance handle, Windows will supply a default icon for use.

Recently, the Win32 API provides the LoadImage function for loading icons, bitmaps, and mouse cursors from a single function. You can find more information about this function on MSDN.

Internally, Icons are stored under numeric resource type RT_ICON == 3, and are grouped under RT_GROUP_ICON == 14.

Bitmaps

Bitmaps can be loaded similarly to Icons in resource files:

(bitmap ID or name) BITMAP [DISCARDABLE] "bitmapfile.bmp"

Bitmaps can be accessed with the aptly named LoadBitmap function (again, new versions of the Win32 API prefer you use LoadImage to load a bitmap, icon, or cursor). LoadBitmap returns an HBITMAP handle type:

HBITMAP hBmp;
hBmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_BITMAP1));

Or, if we have named our bitmap resource:

hBmp = LoadBitmap(hInst, "MyBitmapRes");

Bitmaps are large resources, and if windows can't load the bitmap into memory (or if the ID or name value is invalid), the function will return a NULL value. Make sure you test this value before you use the handle.

Bitmaps must be unloaded from memory by passing the handle to the DeleteObject() function. You can find more information about this on MSDN

Bitmap identifiers generally use a "IDB_" prefix, to indicate that it is the ID of a bitmap.

Internally, Bitmaps are stored under numeric resource type RT_BITMAP == 2.

Mouse Cursors

Mouse cursors are specified similarly to icons and bitmaps, and are loaded with the LoadCursor function.

Internally, cursors are stored under numeric resource type RT_CURSOR == 1, and are grouped under RT_GROUP_CURSOR == 12.

As for any resource that implies binary data, the use of an external file with "filename" is recommended. However, most resource compilers allow to inline binary data to the resource file in this way:

42 ICON
{
 123,4567,0x89AB,0xCDEF
 '\x01','\x23',"ajx"
}

with this rule, coming from Win16 heritage:

  • Numbers (decimal or hexadecimal) are stored contiguously as 16-bit little-endian quantities (unaligned)
  • Characters are stored as 8-bit quantities

String Tables

A resource script can have many string tables, although this is unneccessary: the tables aren't differentiated (i.e. they get merged), and each string object, in any table, must have a unique identifier. Strings in a string table also may not use names, but instead must use numeric identifiers. After all, it doesn't make any sense to have to address a string with a string, does it?

Here is a general string table:

STRINGTABLE DISCARDABLE
BEGIN
   IDS_STRING1, "This is my first string"
   IDS_STRING2, "This is my second string"
   ...
END

It is important to note that in place of the BEGIN and END keywords, the programmer may also use the more C-like curly brackets, as such:

STRINGTABLE DISCARDABLE
{
   IDS_STRING1, "This is my first string"
   IDS_STRING2, "This is my second string"
   ...
}

Some people prefer one over the other, but they are all the same to the resource compiler.

Strings can be loaded using the LoadString function. LoadString is more involved then the LoadBitmap or LoadIcon functions:

int LoadString(HINSTANCE hInstance, UINT uID, LPTSTR lpBuffer, int nBufferMax);

The hInstance parameter, as we know, is the instance handle for the module that contains the string. The uID parameter contains the string number that we are trying to access. lpBuffer is the character array variable that will receive the string, and the nBufferMax number tells windows what the maximum number of characters that can be loaded is. This count is a security precaution, so make sure not to allow Windows to write character data beyond the end of the string. MSDN displays a large warning on the page for this function, and it is important that programmers heed this warning. msdn

Windows will automatically zero-terminate the string, once it is written to the buffer. LoadString will return the number of characters that were actually written into the string, in case the number of characters is less then the maximum number allowed. If this return value is 0, the string resource does not exist, or could not be loaded.

Strings can have "\0" in the middle. As strings are saved as counted strings, LoadString returns the number of characters saved, including the zeroes in between. But most Resource Editors fail with such strings.

Internally, stringtables are stored under numeric resource type RT_STRING == 6, in groups of upto 16 adjanced IDs.

Accelerators

Keyboard accelerators are a common part of nearly every windows application, and therefore it is a good idea to simplify the job of creating accelerators by putting them in a resource script. Here is how to create an accelerator table:

(Accelerator Table ID or name) ACCELERATORS [DISCARDABLE]
BEGIN
   (key combination), (Command ID)
   ...
END

Key combinations are specified in terms of either a string literal character ("A" for instance) or a virtual key code value. Here are some examples:

IDA_ACCEL_TABLE ACCELERATORS DISCARDABLE
BEGIN
   "A", IDA_ACTION_A //Shift+A
END

Now, when the key combination "Shift+A" is pressed, your window procedure will receive a WM_COMMAND message with the value IDA_ACTION_A in the WPARAM field of the message.

If we want to use combinations of the "Alt" key, or the "Ctrl" key, we can use the ALT and CONTROL keywords, respectively:

IDA_ACCEL_TABLE ACCELERATORS DISCARDABLE
BEGIN
   "a", IDA_ACTION_A, ALT          //Alt+A
   "b", IDA_ACTION_B, CONTROL      //Ctrl+B
   "c", IDA_ACTION_C, ALT, CONTROL //Alt+Ctrl+A
END

Also, we can use the "^" symbol to denote a CONTROL key code:

IDA_ACCEL_TABLE ACCELERATORS DISCARDABLE
BEGIN
   "^a", IDA_ACTION_A //Control+A
END

Similarly, if we want to be super hackers, would could use the ASCII code directly:

IDA_ACCEL_TABLE ACCELERATORS DISCARDABLE
BEGIN
   65, IDA_ACTION_A, ASCII //65 = "A", Shift+A
END

Or, we could refer to keys (including non-alphanumeric keys) with their Virtual Key Code identifiers, by using the VIRTKEY identifier:

IDA_ACCEL_TABLE ACCELERATORS DISCARDABLE
BEGIN
   VK_F12, IDA_ACTION_F12, VIRTKEY             //press the "F12 Key"
   VK_DELETE, IDA_ACTION_DEL, VIRTKEY, CONTROL //Ctrl+Delete
END

Now, If we make an accelerator correspond to a menu command, the menu command will light up when we press the accelerator. That is, the menu will light up unless we specify the "NOINVERT" keyword:

IDA_ACCEL_TABLE ACCELERATORS DISCARDABLE
BEGIN
   "A", IDA_ACTION_A, NOINVERT //Shift+A (non inverted menu selection)
END

To Load an accelerator table, we need to use the LoadAccelerators function, as such:

HACCEL hAccel;
hAccel = LoadAccelerators(hInst, MAKEINTRESOURCE(IDA_ACCEL_TABLE));

Again, we could have given our resource a string name, and used that string to load the table.

When using accelerators, we need to alter our message loop to intercept the keypress messages, and translate them into command messages according to our accelerator table rules. We use the TranslateAccelerator function, to intercept the keypress messages, and translate them into command messages, as such:

while ( (Result = GetMessage(&msg, NULL, 0, 0)) != 0)
{
    if (Result == -1)
    {
        // error handling
    }
    else
    {
        if (!TranslateAccelerator(hwnd, haccel, &msg))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }
}

Also, if we are writing an MDI application, we need to intercept Accelerator messages from the child windows, we use the TranslateMDISysAccel function also:

while ( (Result = GetMessage(&msg, NULL, 0, 0)) != 0)
{
    if (Result == -1)
    {
        // error handling
    }
    else
    {
        if (  !TranslateMDISysAccel(hwndClient, &msg)
           && !TranslateAccelerator(hwndFrame, haccel, &msg) )
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }
}

Where "hwndFrame" is the handle to the frame window, and "hwndClient" is the handle to the MDI client window.

Internally, Accelerators are stored under numeric resource type RT_ACCELERATOR == 9.

Menus

Menus can be defined in a resource script using the MENU keyword. There are 2 types of items that appear in a menu, the top level "POPUP" menu items, and the secondary "MENUITEM" items. These are defined in a menu as such:

(ID or name) MENU [DISCARDABLE]
BEGIN
   POPUP "File"
   POPUP "Edit"
   BEGIN
      MENUITEM "Copy", IDM_EDIT_COPY
      MENUITEM "Paste", IDM_EDIT_PASTE
   END
   ...
 END

We have included a few examples here, so that you can see the difference between a POPUP and a MENUITEM. When we have a menu with the ID_MENU identifier, we can load it into our program as such:

HMENU hmenu;
hmenu = LoadMenu(hInst, MAKEINTRESOURCE(ID_MENU));

Once we have this handle, we can pass it to the CreateWindow function, and apply it to our window.

When a menu item is selected, the host program receives a WM_COMMAND message, with the menu item identifier in the WPARAM parameter. If we have a basic window procedure switch-case statement, we can see this as follows:

case WM_COMMAND:
   switch(WPARAM)
   {
       case IDM_EDIT_COPY:
          //handle this action
          break;
       case IDM_EDIT_PASTE:
          //handle this action
          break;
   }
   break;

In a menu, if we want to associate a menu item with an accelerator, we can define it as such:

ID_MENU MENU DISCARDABLE
BEGIN
   POPUP "File"
   POPUP "Edit"
   BEGIN
      MENUITEM "&Copy", IDM_EDIT_COPY
      MENUITEM "&Paste", IDM_EDIT_PASTE
   END
   ...
 END

Notice how we put the ampersand (&) in front of the "C" in "Copy" and the "P" in "Paste". This means that those letters will be underlined, but more importantly, if an accelerator key combination is pressed, those items in the menu will be highlighted (unless the NOINVERT tag is specified in the accelerator table). If an ampersand is placed before a POPUP menu item, pressing ALT+ that letter will popup that menu. For instance, lets define our menu:

ID_MENU MENU DISCARDABLE
BEGIN
   POPUP "&File"
   POPUP "&Edit"
   BEGIN
      MENUITEM "Copy", IDM_EDIT_COPY
      MENUITEM "Paste", IDM_EDIT_PASTE
   END
   ...
 END

Now, if we press ALT+F, we will pop open the File menu, and if we press ALT+E it will open the Edit menu. That's pretty nice functionality for only a single extra character to type.

Internally, Menus are stored under numeric resource type RT_MENU == 4.

Version Information

A program can include certain information about its version, and its author in a resource script. This version information appears when you right-click the executable in Windows, and click "Properties". In the properties dialog box, this information appears on the "Version" tab.

BLOCK "StringFileInfo"
  BEGIN
      BLOCK "040904E4"
      BEGIN
          VALUE "CompanyName",      "My Company.\0"
          VALUE "FileDescription",  "A Win32 program."
          VALUE "FileVersion",      "1.0.0.0\0"
          VALUE "ProductName",      "The product name.\0"
          VALUE "ProductVersion",   "1.0\0"
          VALUE "LegalCopyright",   "My Company.\0"
      END
  END
  BLOCK "VarFileInfo"
  BEGIN
      VALUE "Translation", 0x409, 1252
  END

Internally, VersionInfo is stored under numeric resource type RT_VERSION == 16. It was introduced with Windows 3.

Dialog Boxes

Dialog box resources follow a general pattern:

(Dialog ID or name) DIALOG [DISCARDABLE] x, y, width, height
TITLE "(dialog box title)"
[CLASS "(class name)"]
FONT "(font name)"
BEGIN
   ...
END

if a dialog box is not being associated with a class, the CLASS field does not need to be filled in. All strings listed as being in quotes must be in quotes in the resource script or there will be an error. Individual items in a dialog box are then specified between the BEGIN and END tags.

Internally, Dialogs are stored under numeric resource type RT_DIALOG == 5.

Generic Controls

CONTROL classname,windowname,id,left,top,width,height,windowflags

Specific Buttons

Edit Boxes

Manifests

Manifest resources contain UTF-8 encoded XML description of operating system and DLL dependency. Mostly, this resource dictates to use the Windows XP Version 6.0 comctl32.dll, to have Luna style for the standard and common controls.

Internally, Manifests are stored under numeric resource type RT_MANIFEST == 24. It was introduced with Windows 4.1.

User-type resources

User-type resources should use some greater resource type identifiers, or RT_RCDATA == 10.


Resources.rtf

+$#AK Resources Vu dans Win32 HLP 11_Mo (Microsft 1995)

A resource is binary data that a resource compiler or developer adds to an application's executable file. A resource can be either standard or defined. The data in a standard resource describes an icon, cursor, menu, dialog box, bitmap, enhanced metafile, font, accelerator table, message-table entry, string-table entry, or version. An application-defined resource, also called a custom resource, contains any data required by a specific application.

+$#A About Resources

This overview describes the functions that enable applications to find a resource in a module; load a resource into memory; add, delete or replace a resource in an executable file; and generate a list of the resources contained in a module. For specific information about the organization of resource data within executable files, refer to the resource formats documentation.

For information about how to create standard resources, refer to the following table.

Resource |  | Topic
Accelerator table |  | Keyboard Accelerators
Bitmap | Bitmaps
Cursor | Cursors
Dialog box | Dialog Boxes
Enhanced metafile | Metafiles
Font | Fonts and Text
Icon | Icons
Menu | Menus (Windows NT)
Message-table entry | Your message-compiler documentation
String-table entry | String Manipulation
Version information |  | File Installation Library

For information about how to include resource data in a Microsoft® Windows® executable file, refer to the documentation for your resource compiler.

+$#A Finding and Loading Resources

Before using a resource, an application must load it into memory. The FindResource and FindResourceEx functions find a resource in a module and return a handle to the binary resource data. FindResource locates a resource by type and name. FindResourceEx locates the resource by type, name, and language. Information about FindResource in this topic also applies to FindResourceEx.

The LoadResource function uses the resource handle returned by FindResource to load the resource into memory. After an application loads a resource by using LoadResource, Windows automatically unloads and reloads the resource as memory conditions and application execution require. Thus, an application need not explicitly unload a resource it no longer needs.

An application can use FindResource and LoadResource to find and load any type of resource, but these functions should be used only if the application must access the binary resource data for subsequent function calls. To use a resource immediately, an application should use one of the following resource-specific functions to find and load resources in one call.

Function |  | Action
FormatMessage |  | Loads and formats a message-table entry.
LoadAccelerators | Loads an accelerator table.
LoadBitmap | Loads a bitmap resource.
LoadCursor | Loads a cursor resource.
LoadIcon | Loads an icon resource.
LoadImage | Loads an icon, cursor, bitmap, or enhanced metafile resource.
LoadMenu | Loads a menu resource.
LoadString |  | Loads a string-table entry.

Before terminating, an application should release the memory occupied by accelerator tables, bitmaps, cursors, icons, and menus by using one of the functions in the following table.

Resource |  | Release function
Accelerator table |  | DestroyAcceleratorTable
Bitmap | DeleteObject
Cursor | DestroyCursor
Icon | DestroyIcon
Menu |  | DestroyMenu

When the application terminates, Windows automatically releases the memory occupied by the other types of resources.

+$#A Adding, Deleting, and Replacing Resources

Applications must frequently add, delete, or replace resources in executable files. Two methods can be used to accomplish these tasks. The first is to edit the resource-definition file, recompile the resources, and add the recompiled resources to the application's executable file. The second method is to copy the resource data directly into the application's executable file.

For example, to localize an English-language application for use in Norway, it may be necessary to replace the English dialog box with one using Norwegian. A developer creates an appropriate dialog box by using a dialog box editor or by writing a template in the resource-definition file. The developer then recompiles the resources and adds the new resources to the application's executable file.

If an appropriate dialog box exists in binary form, however, the developer can copy the data directly to the executable file being localized by using three Windows functions. The BeginUpdateResource function creates an update handle for the executable file whose resources are to be changed. The UpdateResource function uses this handle to add, delete, or replace a resource in the executable file. The EndUpdateResource function closes the handle.

After an update handle to an executable file is created by BeginUpdateResource, an application can use UpdateResource repeatedly to make changes to the resource data. Each call to UpdateResource contributes to an internal list of additions, deletions, and replacements but does not actually write the data to the executable file. Immediately before closing the update handle, EndUpdateResource writes the accumulated changes to the executable file.

Sometimes, an application must copy resources or find resource sizes. The LoadLibrary function provides a module handle to an executable file whose resources are to be copied, and the LockResource function provides a pointer to the resource data in the specified module. The SizeofResource function returns the size, in bytes, of a specified resource.

+$#A Enumerating Resources

Three Windows functions enable an application to obtain lists of resource types, names, and languages in a specified module. The EnumResourceTypes function provides a list of resource types found in the module, the EnumResourceNames function provides the name of each resource within a given type, and the EnumResourceLanguages function provides the language of each resource of a given name and type. These functions and their associated callback functions enable applications to create a list of all resources in a module. This process is described in Creating a Resource List.

+$#A Using Resources

• Updating resources

• Creating a resource list

+$#A Updating Resources

The following example copies a dialog box resource from one executable file, HAND.EXE, to another, FOOT.EXE, by following these steps:

1. The LoadLibrary function loads the executable file HAND.EXE.

2. The FindResource and LoadResource functions locate and load the dialog box resource named If from the file.

3. The LockResource function returns a pointer to the dialog box resource data.

4. The BeginUpdateResource function opens an update handle FOOT.EXE.

5. The UpdateResource function copies the dialog box resource from HAND.EXE to FOOT.EXE.

6. The EndUpdateResource function completes the update.

The following code implements these steps.

HRSRC hResLoad; // handle to loaded resource

HANDLE hExe; // handle to existing .EXE file

HRSRC hRes; // handle/ptr. to res. info. in hExe

HANDLE hUpdateRes; // update resource handle

char *lpResLock; // pointer to resource data

BOOL result;

// Load the .EXE file that contains the dialog box you want to copy.

hExe = LoadLibrary("hand.exe");

if (hExe == NULL) {

ErrorHandler("Could not load exe.");

}

// Locate the dialog box resource in the .EXE file.

hRes = FindResource(hExe, "AboutBox", RT_DIALOG);

if (hRes == NULL) {

ErrorHandler("Could not locate dialog box.");

}

// Load the dialog box into global memory.

hResLoad = LoadResource(hExe, hRes);

if (hResLoad == NULL) {

ErrorHandler("Could not load dialog box.");

}

// Lock the dialog box into global memory.

lpResLock = LockResource(hRes);

if (lpResLock == NULL) {

ErrorHandler("Could not lock dialog box.");

}

// Open the file to which you want to add the dialog box resource.

hUpdateRes = BeginUpdateResource("foot.exe", FALSE);

if (hUpdateRes == NULL) {

ErrorHandler("Could not open file for writing.");

}

// Add the dialog box resource to the update list.

result = UpdateResource(hUpdateRes, // update resource handle

RT_DIALOG, // change dialog box resource

"AboutBox", // dialog box name

MAKELANGID(LANG_NEUTRAL,

SUBLANG_NEUTRAL), // neutral language ID

lpResLock, // ptr to resource info

SizeofResource(hExe, hRes)); // size of resource info.

if (result == FALSE) {

ErrorHandler("Could not add resource.");

}

// Write changes to FOOT.EXE and then close it.

if (!EndUpdateResource(hUpdateRes, FALSE)) {

ErrorHandler("Could not write changes to file.");

}

// Clean up.

if (!FreeLibrary(hExe)) {

ErrorHandler("Could not free executable.");

}

+$#A Creating a Resource List

The following example creates a list of every resource in the HAND.EXE file. The list is written to the RESINFO.TXT file.

The code demonstrates how to load the executable file, create a file in which to write resource information, and call the EnumResourceTypes function to send each resource type found in the module to the application-defined callback function EnumTypesFunc. See EnumResTypeProc for information on callback functions of this type. This callback function uses the EnumResourceNames function to pass the name of every resource within the specified type to another application-defined callback function, EnumNamesFunc. See EnumResNameProc for information on callback functions of this type. EnumNamesFunc uses the EnumResourceLanguages function to pass the language of every resource of the specified type and name to a third callback function, EnumLangsFunc. See EnumResLangProc for information on callback functions of this type. EnumLangsFunc writes information about the resource of the specified type, name, and language to the RESINFO.TXT file.

char szBuffer[80]; // print buffer for EnumResourceTypes

DWORD cbWritten; // number of bytes written to res. info. file

int cbString; // length of string in sprintf

// Declare callback functions.

BOOL EnumTypesFunc(

HANDLE hModule,

LPTSTR lpType,

LONG lParam);

BOOL EnumNamesFunc(

HANDLE hModule,

LPCTSTR lpType,

LPTSTR lpName,

LONG lParam);

BOOL EnumLangsFunc(

HANDLE hModule,

LPCTSTR lpType,

LPCTSTR lpName,

WORD wLang,

LONG lParam);

// Load the .EXE whose resources you want to list.

hExe = LoadLibrary("hand.exe");

if (hExe == NULL) {

ErrorHandler("Could not load .EXE.");

}

// Create a file to contain the resource info.

hFile = CreateFile("resinfo.txt", // name of file

GENERIC_READ | GENERIC_WRITE, // access mode

0, // share mode

(LPSECURITY_ATTRIBUTES) NULL, // no security

CREATE_ALWAYS, // create flags

FILE_ATTRIBUTE_NORMAL, // file attributes

(HANDLE) NULL); // no template

if (hFile == INVALID_HANDLE_VALUE) {

ErrorHandler("Could not open file.");

}

// Find all of the loaded file's resources.

cbString = sprintf(szBuffer,

"The file contains the following resources:\n\n");

WriteFile(hFile, // file to hold resource info.

szBuffer, // what to write to the file

(DWORD) cbString, // number of bytes in szBuffer

&cbWritten, // number of bytes written

NULL); // no overlapped I/O

EnumResourceTypes(hExe, // module handle

(ENUMRESTYPEPROC)EnumTypesFunc, // callback function

0); // extra parameter

// Unload the executable file whose resources were

// enumerated and close the file created to contain

// the resource information.

FreeLibrary(hExe);

CloseHandle(hFile);

// FUNCTION: EnumTypesFunc(HANDLE, LPSTR, LONG)

//

// PURPOSE: Resource type callback

BOOL EnumTypesFunc(

HANDLE hModule, // module handle

LPTSTR lpType, // address of resource type

LONG lParam) // extra parameter, could be

// used for error checking

{

int cbString;

// Write the resource type to a resource information file.

// The type may be a string or an unsigned decimal

// integer, so test before printing.

if ((ULONG)lpType & 0xFFFF0000) {

cbString = sprintf(szBuffer, "Type: %s\n", lpType);

}

else {

cbString = sprintf(szBuffer, "Type: %u\n", (USHORT)lpType);

}

WriteFile(hFile, szBuffer, (DWORD) cbString,

&cbWritten, NULL);

// Find the names of all resources of type lpType.

EnumResourceNames(hModule,

lpType,

(ENUMRESNAMEPROC)EnumNamesFunc,

0);

return TRUE;

}

// FUNCTION: EnumNamesFunc(HANDLE, LPSTR, LPSTR, LONG)

//

// PURPOSE: Resource name callback

BOOL EnumNamesFunc(

HANDLE hModule, // module handle

LPCTSTR lpType, // address of resource type

LPTSTR lpName, // address of resource name

LONG lParam) // extra parameter, could be

// used for error checking

{

int cbString;

// Write the resource name to a resource information file.

// The name may be a string or an unsigned decimal

// integer, so test before printing.

if ((ULONG)lpName & 0xFFFF0000) {

cbString = sprintf(szBuffer, "\tName: %s\n", lpName);

}

else {

cbString = sprintf(szBuffer, "\tName: %u\n",

(USHORT)lpName);

}

WriteFile(hFile, szBuffer, (DWORD) cbString,

&cbWritten, NULL);

// Find the languages of all resources of type

// lpType and name lpName.

EnumResourceLanguages(hModule,

lpType,

lpName,

(ENUMRESLANGPROC)EnumLangsFunc,

0);

return TRUE;

}

// FUNCTION: EnumLangsFunc(HANDLE, LPSTR, LPSTR, WORD, LONG)

//

// PURPOSE: Resource language callback

BOOL EnumLangsFunc(

HANDLE hModule, // module handle

LPCTSTR lpType, // address of resource type

LPCTSTR lpName, // address of resource name

WORD wLang, // resource language

LONG lParam) // extra parameter, could be

used for error checking

{

HANDLE hResInfo;

char szBuffer[80];

int cbString = 0;

hResInfo = FindResourceEx(hModule, lpType, lpName, wLang);

// Write the resource language to the resource information file.

cbString = sprintf(szBuffer, "\t\tLanguage: %u\n",

(USHORT)wLang);

WriteFile(hFile, szBuffer, (DWORD) cbString,

&cbWritten, NULL);

// Write the resource handle and size to buffer.

cbString = sprintf(szBuffer,

"\t\thResInfo == %lx, Size == %lu\n\n",

hResInfo,

SizeofResource(hModule, hResInfo));

WriteFile(hFile, szBuffer, (DWORD) cbString,

&cbWritten, NULL);

return TRUE;

}

+$#A Resource Functions

Following are the functions used with resources.

BeginUpdateResource
CopyImage
EndUpdateResource
EnumResLangProc
EnumResNameProc
EnumResourceLanguages
EnumResourceNames
EnumResourceTypes
EnumResTypeProc
FindResource
FindResourceEx
LoadImage
LoadResource
LockResource
SizeofResource
UpdateResource

Obsolete or Deleted Functions

FreeResource
SetResourceHandler
UnlockResource


Win32 Tutorial - Lesson 2: Introduction to Resources

Vu dans ... http://www.functionx.com/win32/Lesson02.htm

Home

Introduction to Resources

Resources Fundamentals

Introduction

A resource is an object that cannot be defined in C++ terms but that is needed to complete a program. In the strict sense, it is text that contains a series of terms or words that the program can interpret through code. Examples of resources are menus, icons, cursors, dialog boxes, sounds, etc.

There are various means of creating a resource and the approach you use depends on the resource. For example, some resources are completely text-based, such is the case for the String Table or the Accelerator Table. Some other resources must be designed, such is the case for icons and cursors. Some other resources can be imported from another, more elaborate application, such is the case for high graphic pictures. Yet some resources can be a combination of different resources.

Resource Creation

As mentioned already, resources are not a C++ concept but a Microsoft Windows theory of completing an application. Therefore, the programming environment you use may or may not provide you with the means of creating certain resources. Some environments like Borland C++ Builder or Visual C++ (6 and .NET) are complete with (almost) anything you need to create (almost) any type of resources. Some other environments may appear incomplete, allowing you to create only some resources, the other resources must be created using an external application not provided; such is the case for C++BuilderX.

Upon creating a resource, you must save it. Some resources are created as their own file, such is the case for pictures, icons, cursors, sound, etc. Each of these resources has a particular extension depending on the resource. After creating the resources, you must add them to a file that has the extension .rc. Some resources are listed in this file using a certain syntax. That's the case for icons, cursors, pictures, sounds, etc. Some other resources must be created directly in this file because these resources are text-based; that's the case for menus, strings, accelerators, version numbers, etc.

After creating the resource file, you must compile it. Again, some environments, such as Microsoft Visual C++, do this automatically when you execute the application. Some other environments may require you to explicitly compile the resource. That's the case for Borland C++ Builder and C++BuilderX. (The fact that these environments require that you compile the resource is not an anomaly. For example, if you create a Windows application that is form-based in C++ Builder 6 or Delphi, you can easily add the resources and they are automatically compiled and added to the application. If you decide to create a Win32 application, C++ Builder believes that you want to completely control your application; so, it lets you decide when and how to compile a resource. This means that it simply gives you more control).

Practical Learning Practical Learning: Introducing Windows Resources

  1. If you are using Borland C++ Builder, create a new Win32 application using Console Wizard as we did in Lesson 1
    1. Save the project as Resources1 in a new folder called Resources1
    2. Save the unit as Exercise.cpp
  2. If you are using Microsoft Visual C++,
    1. Create a new Win32 Application as done the previous time. Save the project as Resources1 and
    2. Create a new C++ Source file named Exercise.cpp
  3. Implement the source file as follows(for Borland C++ Builder, only add the parts that are not in the code):
    //---------------------------------------------------------------------------
#include <windows.h>
#pragma hdrstop

//---------------------------------------------------------------------------

#pragma argsused
//---------------------------------------------------------------------------
LPCTSTR ClsName = L"FundApp";
LPCTSTR WndName = L"Resources Fundamentals";
LRESULT CALLBACK WndProcedure(HWND hWnd, UINT uMsg,
                  WPARAM wParam, LPARAM lParam);
//---------------------------------------------------------------------------
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine, int nCmdShow)
{
    MSG        Msg;
    HWND       hWnd;
    WNDCLASSEX WndClsEx;

    // Create the application window
    WndClsEx.cbSize        = sizeof(WNDCLASSEX);
    WndClsEx.style         = CS_HREDRAW | CS_VREDRAW;
    WndClsEx.lpfnWndProc   = WndProcedure;
    WndClsEx.cbClsExtra    = 0;
    WndClsEx.cbWndExtra    = 0;
    WndClsEx.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
    WndClsEx.hCursor       = LoadCursor(NULL, IDC_ARROW);
    WndClsEx.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
    WndClsEx.lpszMenuName  = NULL;
    WndClsEx.lpszClassName = ClsName;
    WndClsEx.hInstance     = hInstance;
    WndClsEx.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);

    // Register the application
    RegisterClassEx(&WndClsEx);

    // Create the window object
    hWnd = CreateWindowEx(0,
                          ClsName,
                          WndName,
                             WS_OVERLAPPEDWINDOW,
                          CW_USEDEFAULT,
                             CW_USEDEFAULT,
                          CW_USEDEFAULT,
                             CW_USEDEFAULT,
                          NULL,
                          NULL,
                          hInstance,
                          NULL);

    // Find out if the window was created
    if( !hWnd ) // If the window was not created,
        return FALSE; // stop the application

    // Display the window to the user
    ShowWindow(hWnd, nCmdShow);// SW_SHOWNORMAL);
    UpdateWindow(hWnd);

    // Decode and treat the messages
    // as long as the application is running
    while( GetMessage(&Msg, NULL, 0, 0) )
    {
             TranslateMessage(&Msg);
             DispatchMessage(&Msg);
    }

    return Msg.wParam;
}
//---------------------------------------------------------------------------
LRESULT CALLBACK WndProcedure(HWND hWnd, UINT Msg,
               WPARAM wParam, LPARAM lParam)
{
    switch(Msg)
    {
    case WM_DESTROY:
        PostQuitMessage(WM_QUIT);
        break;
    default:
        // Process the left-over messages
        return DefWindowProc(hWnd, Msg, wParam, lParam);
    }
    // If something was not done, let it go
    return 0;
}
//---------------------------------------------------------------------------
  4. Execute the application to test it


API Windows en C

Les ressources

Table des matières Plier Déplier

  • I. Introduction
  • II. Incorporation des ressources à l'exécutable
  • III. Le script de ressources
  • IV. Ressources de type menu
  • V. Code complet
    • V-A. resource.h
    • V-B. resource.rc
    • V-C. winmain.c

Les ressources. ♪

Article lu 6039 fois.

L'auteur

CGi Profil Pro Site personnel

L'article

Publié le 15 juin 2005 - Mis à jour le 4 janvier 2013

I. Introduction

Dans ce chapitre nous allons aborder les ressources.

Tout d'abord qu'appelle-t-on les ressources dans un programme Windows ?

Ce sont des données de toutes natures qui sont incorporées à l'exécutable. Cela peut être des images, des icônes, des chaînes de caractères, des blocs de données de toutes sortes… Mais aussi des boîtes de dialogue et des menus qui seront construits à partir de script.

Image non disponible

II. Incorporation des ressources à l'exécutable

L'incorporation des ressources à l'exécutable est réalisée par le linker. Nous devons lui fournir un fichier contenant les ressources. Ces fichiers ont l'extension « .res ». Ils sont compilés par un compilateur de ressources, auquel on fournit un fichier de script de ressources. Les fichiers de script de ressources sont des fichiers texte ayant l'extension « .rc ». Il existe aussi des éditeurs de ressources permettant de créer visuellement les fichiers ressources.

Ce tutoriel n'étant pas destiné à des outils particuliers, nous utiliserons uniquement les scripts de ressources dans les exemples qui vont suivre.

Si vous utilisez un EDI, il suffit d'ajouter les scripts de ressources au projet (pour Dev-C++ il faut les ajouter par le menu « Projects » puis « Projects Options » puis par le bouton « Load Resource », pour C++ Builder il faut tout simplement ajouter les fichiers au projet). La compilation des ressources sera dans ce cas transparente.

Nous allons en voir deux dans ce chapitre : les icônes et les menus.

III. Le script de ressources

Nous allons rependre l'exemple du chapitre 3 - Les commandes et notifications. Nous allons d'abord ajouter des icônes dans les ressources de l'exécutable. Créons tout d'abord un fichier script de ressources nommé « resource.rc » avec le texte suivant :

Sélectionnez
1 ICON icone.ico
2 ICON autre.ico

Chaque ligne est composée de trois éléments, le premier est un identificateur, le second le type de ressource (ICON pour une icône dans l'exemple) le dernier est le contenu, dans le cas de l'exemple ce sera le contenu d'un fichier. Ils doivent bien sûr exister. Les ayant mis dans le même dossier que les fichiers source du programme, je n'ai pas indiqué le chemin pour les localiser. S'ils se trouvent ailleurs, il faudra bien sûr mettre le chemin (j'ai dû tout de même le mettre pour la compilation avec Dev-C++ malgré qu'ils se trouvaient dans le même dossier).

Certains compilateurs de ressources demandent d'inclure les fichiers entêtes de Windows qui contiennent la définition des identificateurs utilisés dans le fichier script de ressources.

Il peut y avoir des différences notables entre les différents compilateurs de ressources. Je vous invite à consulter l'aide de celui que vous utilisez si vous rencontrez des problèmes de compilation.

Je le répète une dernière fois, ce fichier devra être ajouté au projet si vous possédez un EDI ou compilé à l'aide d'un compilateur de ressources et lié à l'exécutable si vous n'avez pas d'EDI.

À ce stade, si vous compilez et que vous visualisez le fichier exécutable dans l'explorateur de fichiers, il devrait avoir la première icône de la liste (ce n'est pas forcement vrai si vous utilisez un EDI, ils peuvent ajouter automatiquement une icône aux ressources de l'exécutable).

Nous allons maintenant mettre la deuxième icône comme icône de la fenêtre (celle qui se trouve à gauche sur la barre de titre) :

Sélectionnez
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance,
                                                LPSTR lpCmdLine, int nCmdShow)
{
    WNDCLASS wc;

    wc.style = 0 ;
    wc.lpfnWndProc = MainWndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = NULL;
    wc.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(2));
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = NULL;
    wc.lpszMenuName =  "MyMenu";
    wc.lpszClassName = "MaWinClass";

    if(!RegisterClass(&wc)) return FALSE;

Pour cela on affecte le champ hIcon de la classe de fenêtre avec une icône que l'on charge avec la fonction LoadIcon. Elle reçoit comme paramètre le handle d'instance de l'application, pour son second paramètre elle attend un pointeur sur une chaîne de caractères identifiant l'icône. Dans le script de ressource, nous l'avons identifié avec une valeur numérique. C'est avec la macro MAKEINTRESOURCE que nous faisons cette conversion.

Nous aurions pu les identifier avec des valeurs littérales :

Sélectionnez
ICONE1 ICON icone.ico
ICONE2 ICON autre.ico

Dans ce cas LoadIcon aurait reçu un pointeur sur la chaîne de caractère identifiant l'icône dans son second paramètre.

Sélectionnez
     wc.hIcon = LoadIcon(hinstance,"ICONE2");

IV. Ressources de type menu

Toujours avec le même exemple, nous allons supprimer le menu que l'on avait créé par programme au chapitre 3 et le créer avec un script de ressources :

Sélectionnez
LEMENU MENU
BEGIN
  POPUP "Fichier"
    BEGIN
       MENUITEM "&Nouveau", IDM_NEW
       MENUITEM SEPARATOR
       MENUITEM "&Quitter", IDM_QUIT
    END
  POPUP "Aide"
    BEGIN
       MENUITEM "À propos...", IDM_ABOUT
    END
END

Nous retrouvons là aussi nos trois éléments : l'identificateur de la ressource (littérale dans cet exemple), suivi de son type (MENU : barre de menu) puis de son contenu. Ici le contenu n'est pas un fichier, mais un script de construction de barre de menu, balisé par les mots BEGIN et END. Elle possède deux sous-menus (POPUP : menu déroulant) « fichier » et « Aide ». Le premier possède trois options (MENUITEM) « &Nouveau », SEPARATOR et « &Quitter ». La liste des options d'un sous-menu est aussi balisée par les mots BEGIN et END. Chaque option doit être identifiée par une constante numérique. Cette constante sera envoyée à la procédure de fenêtre quand l'option du menu sera actionnée. Il est préférable de les nommer pour plus de clarté dans le code. Comme elles devront être connues du script de ressource et du fichier source du programme, nous les définissons dans un fichier entête séparé, nommé dans cet exemple « resource.h » :

Sélectionnez
#define IDM_QUIT  1
#define IDM_NEW   2
#define IDM_ABOUT 3

Ce fichier devra donc être inclus dans le fichier source et dans le fichier script de resource (voir code à la fin de ce document). Le menu sera ensuite affecté à la classe de fenêtre. Ceci en affectant au champ lpszMenuName de la classe de fenêtre, un pointeur sur une chaîne de caractères contenant le nom littéral du menu :

Sélectionnez
    wc.lpszMenuName =  "LEMENU";

C'est tout pour sa construction. La récupération des actions du menu se fait sur réception des messages WM_COMMAND de la même manière qu'au chapitre 3 :

Sélectionnez
    switch (uMsg)
    {
        case WM_COMMAND:
            if(LOWORD(wParam) == IDM_QUIT) PostMessage(hwnd, WM_CLOSE,0,0);
            /*...         */

Vous avez du remarquer que j'ai mis le caractère '&' dans le texte des options de menu « &Nouveau » et « &Quitter ». Ce signe sert à souligner le caractère qui le suit et à donner la possibilité d'activer l'option correspondante avec la touche du clavier correspondant à ce caractère. Ceci uniquement quand le popup menu est ouvert. À ne pas confondre avec les accélérateurs clavier que l'on verra lors d'un chapitre ultérieur.

Nous aurons l'occasion de revenir sur les différents types de ressources au cours des chapitres suivants.

V. Code complet

V-A. resource.h

Sélectionnez
#define IDM_QUIT  1
#define IDM_NEW   2
#define IDM_ABOUT 3

V-B. resource.rc

Sélectionnez
#include <windows.h>

#include "resource.h"

1 ICON icone.ico
2 ICON autre.ico

LEMENU MENU
BEGIN
  POPUP "Fichier"
    BEGIN
       MENUITEM "&Nouveau", IDM_NEW
       MENUITEM SEPARATOR
       MENUITEM "&Quitter", IDM_QUIT
    END
  POPUP "Aide"
    BEGIN
       MENUITEM "À propos...", IDM_ABOUT
    END
END

V-C. winmain.c

Sélectionnez
#include <windows.h>

#include "resource.h"

HINSTANCE hinst;

LRESULT CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM);

int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance,
                                                LPSTR lpCmdLine, int nCmdShow)
{
    HWND hwnd;
    MSG msg;
    WNDCLASS wc;

    hinst = hinstance;

    wc.style = 0 ;
    wc.lpfnWndProc = MainWndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hinstance;
    wc.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(2));
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = NULL;
    wc.lpszMenuName =  "LEMENU";
    wc.lpszClassName = "MaWinClass";

    if(!RegisterClass(&wc)) return FALSE;

    hwnd = CreateWindow("MaWinClass", "Titre", WS_OVERLAPPEDWINDOW,
                                   CW_USEDEFAULT, CW_USEDEFAULT, 400, 300,
                                                   NULL, NULL, hinstance, NULL);
    if (!hwnd)  return FALSE;

    ShowWindow(hwnd, nCmdShow);

    while (GetMessage(&msg, NULL, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    return msg.wParam;
}
/******************************************************************************/

LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    static HWND hEdit;
    static BOOL EditNotChg = TRUE;
    switch (uMsg)
    {
        case WM_CREATE:
            {
             HFONT hFont;
             hEdit = CreateWindow("edit", "Texte",
               WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL,
                                            0, 0, 0, 0, hwnd, NULL, hinst, NULL);
             hFont = (HFONT)GetStockObject(ANSI_FIXED_FONT);
             SendMessage(hEdit,WM_SETFONT,(UINT)hFont,TRUE);
             SendMessage(hEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN,
                                                                MAKELONG(5, 5));
             return 0;
            }

        case WM_CLOSE:
            if(EditNotChg ||
               MessageBox(hwnd,"Le texte a été modifié.\r\nÊtes-vous sûr de \
vouloir fermer l'application ?"
                           ,"Question ?",MB_YESNO | MB_ICONQUESTION ) == IDYES)
                                                            DestroyWindow(hwnd);
            return 0;

        case WM_COMMAND:
            if(LOWORD(wParam) == IDM_QUIT) PostMessage(hwnd, WM_CLOSE,0,0);

            if(LOWORD(wParam) == IDM_NEW)
                if(EditNotChg ||
                  MessageBox(hwnd,"Le texte a été modifié.\r\nEtes vous sûr de \
vouloir fermer votre travail ?"
                            ,"Question ?",MB_YESNO | MB_ICONQUESTION ) == IDYES)
                      {
                              SendMessage(hEdit,WM_SETTEXT,0,(long)"");
                              EditNotChg = TRUE;
                      }

            if(LOWORD(wParam) == IDM_ABOUT)
                     MessageBox(hwnd,"Mon beau programme !","A propos !",MB_OK);

            if(HIWORD(wParam) == EN_CHANGE) EditNotChg = FALSE;

            return 0;

        case WM_SIZE:
             MoveWindow(hEdit, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
             return 0;

        case WM_DESTROY:
            PostQuitMessage(0);
            return 0;

        default:
            return DefWindowProc(hwnd, uMsg, wParam, lParam);
    }


   ------------------------------ Sommaire -----------------------------

Resource Compiler for Windows NT
Microsoft Windows Resource Compiler (RC) is a tool for the Microsoft Windows
NT operating system.
This document describes how to create a resource-definition (script) file,
and how to compile your application's resources and add them to the
application's executable file.

                    -*-  Contents  -*-

        -   Including Resources in an Application
        -   Creating a Resource-Definition File
        -       Preprocessing Directives
        -       Single-Line Statements
        -       Multiline Statements
        -       Sample Resource-Definition File
        -   Using RC (The RC Command Line)
        -       Defining Names for the Preprocessor
        -       Renaming the Compiled Resource File
        -       Searching for Files
        -       Displaying Progress Messages
        -   Resource-Definition Statements        395
        -       Common Statement Parameters       457
        -       Common Resource Attributes        564
            Preprocessing Reference               3253
            RC Diagnostic Messages

 --------------------------------------------------------------------------
 ---            Sommaire de Resource-Definition Statements              ---

                                              ICON Resource
    Common Statement Parameters               ICON Resource
    Common Resource Attributes                ICON Control
    ACCELERATORS Resource                     LANGUAGE Statement
    AUTO3STATE Control                        LTEXT Control
    AUTOCHECKBOX Control                      MENU Resource
    AUTORADIOBUTTON Control                   MENU Statement
    BITMAP Resource                           MENUEX Statement
    CAPTION Statement                         MENUITEM Statement
    CHARACTERISTICS Statement                 MESSAGETABLE Resource
    CHECKBOX Control                          POPUP Resource
    CLASS Statement                           PUSHBOX Control
    COMBOBOX Control                          PUSHBUTTON Control
  - CONTROL: General Control                  RADIOBUTTON Control
    CTEXT Control                             RCDATA Resource
    CURSOR Resource                           RTEXT Control
    DEFPUSHBUTTON Control                     SCROLLBAR Control
    DIALOG Resource                           STATE3 Control
    DIALOGEX Resource                         STRINGTABLE Resource
    EDITTEXT Control                        - STYLE Statement        2691
    EXSTYLE Statement                         User-Defined Resource
    FONT Resource                             VERSION Statement
    FONT Statement                            VERSIONINFO Resource
    GROUPBOX Control

----------------------------------------------------------------------------

               Including Resources in an Application
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To include resources in your 32-bit Windows application, do the following:

 1. Create individual resource files for cursors, icons, bitmaps, dialog
    boxes, and fonts. To do this, you can use Microsoft Image Editor and
    Dialog Editor (IMAGEDIT.EXE and DLGEDIT.EXE) and Microsoft Windows
    Font Editor (FONTEDIT.EXE).
 2. Create a resource-definition file (script) that describes all the
    resources used by the application.
 3. Compile the script into a resource (.RES) file with RC.
 4. Link the compiled resource files into the application's executable file.

Unlike for the 16-bit versions of the Windows development system, you do not
use RC to include compiled resources into the executable file or to mark the
file as a Windows application. The linker recognizes the compiled resource
files and links them to the executable file.

----------------------------------------------------------------------------
              Creating a Resource-Definition File
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
After creating individual resource files for your application's icon, cursor,
font, bitmap, and dialog-box resources,you create a resource-definition file,
or script. A script file is a text file with the extension .RC.
The script lists every resource in your application and describes some types
of resources in great detail. For a resource that exists in a separate file,
such as an icon or cursor, the script names the resource and the file that
contains it. For some resources, such as a menu, the entire definition of
the resource exists within the script .
A cript file can contain the following types of information:

· Preprocessing directives, which instruct RC to perform actions on the script
  before compiling it. Directives can also assign values to names.
· Statements, which name and describe resources.

The following sections describe directives and statements you can use in a
script. For detailed descriptions and syntax for each statement,
see "Resource-Definition Statements".

Preprocessing Directives
~~~~~~~~~~~~~~~~~~~~~~~~

The following directives can be used as needed in the script to instruct
RC to perform actions or to assign values to names:

Directive   Description

#define  Defines a specified name by assigning it a given value.
#elif    Marks an optional clause of a conditional-compilation block.
#else    Marks the last optional clause of a conditional-compilation block.
#endif   Marks the end of a conditional-compilation block.
#if      Conditionally compiles the script if a specified expression is true.
#ifdef   Conditionally compiles the script if a specified name is defined.
#ifndef  Conditionally compiles the script if a specified name is not defined.
#include Copies the contents of a file into the resource-definition file.
#undef   Removes the definition of the specified name.

 The syntax and semantics for the RC preprocessor is the same as for a
     C compiler. For more information on preprocessing in RC
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            see "Preprocessing Reference".

Single-Line Statements
~~~~~~~~~~~~~~~~~~~~~~

A single-line statement can begin with any of the following keywords:

Keyword Description

BITMAP  Defines a bitmap by naming it and specifying the name of the file
        that contains it. (To use a particular bitmap, the application
        requests it by name.)
CURSOR  Defines a cursor by naming it and specifying the name of the file
        that contains it. (To use a particular cursor, the application
        requests it by name.)
FONT    Specifies the name of a file that contains a font.
ICON    Defines an icon by naming it and specifying the name of the file that
        contains it.(To use a particular icon, the application requests it by name.)
LANGUAGE    Sets the language for all resources up to the next LANGUAGE
        statement or to the end of the file. When the LANGUAGE statement
        appears before the BEGIN in an ACCELERATORS, DIALOG, MENU, RCDATA,
        or STRINGTABLE resource definition, the specified  applies
        only to that resource.
MESSAGETABLE    Defines a message table by naming it and specifying the name
        of the file that contains it. The file is a binary resource file
        generated by the Message Compiler.

Multiline Statements
~~~~~~~~~~~~~~~~~~~~
A multiline statement can begin with any of the following keywords:

Keyword Description

ACCELERATORS    Defines menu accelerator keys.
DIALOG          Defines a template that an application can use to create
                dialog boxes.
MENU            Defines the appearance and function of a menu.
RCDATA          Defines data resources. Data resources let you include binary
                data in the executable file.
STRINGTABLE     Defines string resources. String resources are Unicode strings
                that can be loaded from the executable file.

Each of these multiline statements allows optional statements before the
BEGIN ... END block that defines the resource. You can specify zero or more
of the following statements:

Statement   Decription
CHARACTERISTICS dword   User-defined information about the resource that can
be used by tools that read and write resource files. The value appears in
the compiled resource file. However, it is not stored in the executable file
and is not used by Windows.
LANGUAGE language, sublanguage  Specifies the language for the resource.
The parameters are constants from WINNLS.H.
VERSION dword   User-defined version number for the resource that can be
used by tools that read and write resource files. The value appears in the
compiled resource file. However, it is not stored in the executable file and
is not used by Windows.

Sample Resource-Definition File
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The following example shows a script file that defines the resources for an
application named Shapes:

#include "SHAPES.H"

ShapesCursor  CURSOR  SHAPES.CUR
ShapesIcon    ICON    SHAPES.ICO

ShapesMenu    MENU
    BEGIN
        POPUP "&Shape"
            BEGIN
                MENUITEM "&Clear", ID_CLEAR
                MENUITEM "&Rectangle", ID_RECT
                MENUITEM "&Triangle", ID_TRIANGLE
                MENUITEM "&Star", ID_STAR
                MENUITEM "&Ellipse", ID_ELLIPSE
            END
    END

The CURSOR statement names the application's cursor resource ShapesCursor and
specifies the cursor file SHAPES.CUR,which contains the image for that cursor.
The ICON statement names the application's icon resource ShapesIcon and
specifies the icon file SHAPES.ICO, which contains the image for that icon.
The MENU statement defines an application menu named ShapesMenu, a pop-up
menu with five menu items.
The menu definition, enclosed by the BEGIN and END keywords, specifies each
menu item and the menu identifier that is returned when the user selects that
item. For example, the first item on the menu, Clear, returns the menu
identifier ID_CLEAR when the user selects it.
The menu identifiers are defined in the application header file, SHAPES.H.

----------------------------------------------------------------------------

                    Using RC (The RC Command Line)
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To start RC, use the RC command.
The following line shows RC command-line syntax:

                       RC [options] script-file

The RC command's options parameter can include one or more of the following
 options:

/?  Displays a list of RC command-line options.

/d  Defines a symbol for the preprocessor that you can test with the #ifdef
    directive.

/foresname   Uses resname for the name of the .RES file.

/h  Displays a list of RC command-line options.

/i  Searches the specified directory before searching the directories specified
    by the INCLUDE environment variable.

/lcodepage  Specifies default language for compilation.  For example,
            -l409 is equivalent to including the following statement at the
            top of the resource script file:

                  LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US

/r  Ignored. Provided for compatibility with existing makefiles.

/v  Displays messages that report on the progress of the compiler.

/x  Prevents RC from checking the INCLUDE environment variable when
    searching for header files or resource files.

 Options are not case-sensitive, and a hyphen (-) can be used in place of a
 slash mark (/). You can combine single-letter options if they do not require
 any additional parameters. For example, the following two commands are
 equivalent:
                RC /V /X SAMPLE.RC    <=>    rc -vz sample.rc

 The script-file parameter specifies the name of the resource-definition
 file that contains the names, types, filenames, and descriptions of the
 resources to be compiled.

Defining Names for the Preprocessor
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can specify conditional compilation in a script, based on whether a name
is defined on the RC command line with the /d option, or in the file or an
include file with the #define directive.
For example, suppose your application has a pop-up menu, the Debug menu,that
should appear only with debugging versions of the application.
When you compile the application for normal use, the Debug menu is not
included. The following example shows the statements that can be added to
the resource-definition file to define the Debug menu:

MainMenu MENU
BEGIN
  . . .
#ifdef DEBUG
        POPUP "&Debug"
        BEGIN
                MENUITEM "&Memory usage", ID_MEMORY
                MENUITEM "&Walk data heap", ID_WALK_HEAP
        END
#endif
END

When compiling resources for a debugging version of the application,
you could include the Debug menu by using the following RC command:

   rc -d DEBUG myapp.rc

To compile resources for a normal version of the application¾one that does
not include the Debug menu you could use the following RC command:

   rc myapp.rc

Renaming the Compiled Resource File
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

By default, when compiling resources, RC names the compiled resource (.RES)
file with the base name of the .RC file and places it in the same directory
as the .RC file. CVTRES must then be invoked to convert the .RES file to a
binary resource format which can be understood by the linker (.RBJ).
The following example compiles MYAPP.RC and creates a compiled resource file
named MYAPP.RES in the same directory as MYAPP.RC:

   rc myapp.rc

The /fo option lets you give the resulting .RES file a name that differs from
the name of the corresponding .RC file. For example, to name the resulting
.RES file NEWFILE.RES, you would use the following command:

   rc -fo newfile.res myapp.rc

The /fo option can also place the .RES file in a different directory.
For example, the following command places the compiled resource file
MYAPP.RES in the directory C:\SOURCE\RESOURCE:

   rc -fo c:\source\resource\myapp.res myapp.rc

Searching for Files
~~~~~~~~~~~~~~~~~~~~

By default, RC searches for header files and resource files (such as icon and
cursor files) first in the current directory and then in the directories
specified by the INCLUDE environment variable. (The PATH environment variable
has no effect on which directories RC searches.)

Adding a Directory to Search

You can use the /i option to add a directory to the list of directories RC
searches. The compiler then searches the directories in the following order:

 1. The current directory
 2. The directory or directories you specify by using the /i option,
    in the order in which they appear on the RC command line
 3. The list of directories specified by the INCLUDE environment variable,in
 the order in which the variable lists them,unless you specify the /x option

The following example compiles the resource-definition file MYAPP.RC:

         rc /i c:\source\stuff /i d:\resources myapp.rc

When compiling the script MYAPP.RC, RC searches for header files and resource
files first in the current directory, then in C:\SOURCE\STUFF and
D:\RESOURCES, and then in the directories  specified by the INCLUDE
environment variable.

Suppressing the INCLUDE Environment Variable

You can prevent RC from using the INCLUDE environment variable when determining
the directories to search. To do so, use the /x option.
The compiler then searches for files only in the current directory and in any
directories you specify by using the /i option.
The following example compiles the script file MYAPP.RC:

             rc /x /i c:\source\stuff myapp.rc

When compiling the script MYAPP.RC, RC searches for header files and resource
files first in the current directory and then in C:\SOURCE\STUFF. It does not
search the directories specified by the INCLUDE environment variable.

Displaying Progress Messages
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
By default, RC compiles quietly. It does not display messages that report on
its progress. You can, however, specify that RC is to display these messages.
To do so, use the /v option.
The following example causes RC to report on its progress as it compiles the
resource-definition file SAMPLE.RC and creates the compiled resource file
SAMPLE.RES:
             rc /v sample.rc

----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------

                     Resource-Definition Statements
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This section describes the statements that define the resources that the
Resource Compiler puts in the resource (.RES) file.
Once a resource is linked to the executable file, the application can load
the resource as it is needed at run time.
All resource statements associate an identifying name or number with a given
resource.

Common Statement Parameters              *** TITRE  de recherche ***
Common Resource Attributes
ACCELERATORS Resource
AUTO3STATE Control
AUTOCHECKBOX Control
AUTORADIOBUTTON Control
BITMAP Resource
CAPTION Statement
CHARACTERISTICS Statement
CHECKBOX Control
CLASS Statement
COMBOBOX Control
CONTROL: General Control
CTEXT Control
CURSOR Resource
DEFPUSHBUTTON Control
DIALOG Resource
DIALOGEX Resource
EDITTEXT Control
EXSTYLE Statement
FONT Resource
FONT Statement
GROUPBOX Control
ICON Resource
ICON Control
LANGUAGE Statement

LISTBOX Control
LTEXT Control
MENU Resource
MENU Statement
MENUEX Statement
MENUITEM Statement
MESSAGETABLE Resource
POPUP Resource
PUSHBOX Control
PUSHBUTTON Control
RADIOBUTTON Control
RCDATA
RTEXT Control
SCROLLBAR Control
STATE3 Control
STRINGTABLE Resource
STYLE Statement
User-Defined Resource
VERSION Statement
VERSIONINFO Resource

Common Statement Parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- This section lists parameters in common among the resource or control
  statements.Occasionally,a certain statement will use a parameter
  differently, or may ignore a parameter.
  The statement-specific variation is described with the statement in the
  alphabetical reference.

Common Control Parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~
  The general syntax for a control definition, and the meaning of each
  parameter is as follows:

   control [text,] id, x, y, width, height [, style [, extended-style]]

  Horizontal dialog units are 1/4 of the dialog base width unit.
  Vertical units are 1/8 of the dialog base height unit.
  The current dialog base units are computed from the height and width of
  the current system font.
  The GetDialogBaseUnits function returns the dialog base units in pixels.
  The coordinates are relative to the origin of the dialog box.

                          -  Parameters  -
  control

- Keyword that indicates the type of control being defined,
  such as PUSHBUTTON or CHECKBOX.

  text

- Specifies text that is displayed with the control. The text is positioned
  within the control's specified dimensions, or adjacent to the control.
- This parameter must contain zero or more characters enclosed in double
  quotation marks.  Strings are automatically null-terminated and converted
  to Unicode in the resulting resource file, except for strings specified in
  raw-data statements. (raw-data can be specified in RCDATA and user-defined
  resources.) To specify a Unicode string in raw-data, explicitly qualify
  the string as a wide-character string by using the L prefix.
- By default, the characters listed between the double quotation marks are
  ANSI characters and escape sequences are interpreted as byte escape
  sequences. If the string is preceded by the L prefix, the string is a
  wide-character string and escape sequences are interpreted as two-byte
  escape sequences that specify Unicode characters. If a double quotation
  mark is required in the text, you must include the double quotation mark
  twice or use the \" escape sequence.
- An ampersand (&) character in the text indicates that the following
  character is used as a mnemonic character for the control. When the control
  is displayed, the ampersand is not shown, but the mnemonic character is
  underlined.The user can choose the control by pressing the key
  corresponding  to the underlined mnemonic character.
  To use the ampersand as a character in a string, insert two ampersands (&&).

  id

- Specifies the control identifier. This value must be a 16-bit unsigned
  integer in the range 0 through 65,535 or a simple arithmetic expression
  that evaluates to a value in that range.

  x

- Specifies the x-coordinate of the left side of the control relative to the
  left side of the dialog box.
  This value must be a 16-bit unsigned integer in the range 0 through 65,535.
  The coordinate is in dialog units and is relative to the origin of the
  dialog box, window, or control containing the specified control.

  y

- Specifies the y-coordinate of the top side of the control relative to the
  top of the dialog box.
  This value must be a 16-bit unsigned integer in the range 0 through 65,535.
  The coordinate is in dialog units relative to the origin of the dialog box, window, or control containing the specified
  control.

  width

- Specifies the width of the control.
  This value must be a 16-bit unsigned integer in the range 1 through 65,535.
  The width is in 1/4-character units.

  height

- Specifies the height of the control.
  This value must be a 16-bit unsigned integer in the range 1 through 65,535.
  The height is in 1/8-character units.

  style

- Specifies the control styles.
  Use the bitwise OR (|) operator to combine styles.

  extended-style

- Specifies extended (WS_EX_xxx) styles.
  You must specify a style to specify an extended-style.
  See also EXSTYLE.

Common Resource Attributes
~~~~~~~~~~~~~~~~~~~~~~~~~~

All resource-definition statements include a load-mem option that specifies
the loading and memory characteristics of the resource.
These attributes are divided into two groups:
load attributes and memory attributes.
- The only attribute that is used by Win32 is the DISCARDABLE attribute.
- The remaining attribute specifiers are allowed in the script for
  compatibility with existing scripts, but are ignored.

-*- Load Attributes
The load attributes specify when the resource is to be loaded.
The load parameter must be one of the following:

  PRELOAD
Ignored. In 16-bit Windows, the resource is loaded with the executable file.

  LOADONCALL
Ignored. In 16-bit Windows, the resource is loaded when called.

-*- Memory Attributes
The memory attributes specify whether the resource is fixed or movable,
whether it is discardable, and whether it is pure. The memory parameter
can be one or more of the following:

  FIXED
Ignored. In 16-bit Windows, the resource remains at a fixed memory location.

  MOVEABLE    = mobile
Ignored. In 16-bit Windows, the resource can be moved if necessary in order
to compact memory.

  DISCARDABLE = Jeter
Resource can be discarded if no longer needed.

  PURE
Ignored. Accepted for compatibility with existing resource scripts.

 IMPURE
Ignored. Accepted for compatibility with existing resource scripts.

The default is DISCARDABLE for cursor, icon, and font resources.

      *************************************************************

ACCELERATORS Resource        stroke = trait course caresse ...

acctablename ACCELERATORS
[optional-statements]
BEGIN
    event, idvalue, [type] [options]
    . . .
END
The ACCELERATORS statement defines one or more accelerators for an application.
An accelerator is a keystroke defined by the application to give the user a
quick way to perform a task. The TranslateAccelerator function is used to
translate accelerator messages from the application queue into WM_COMMAND or
WM_SYSCOMMAND messages.

 Parameters

acctablename

Specifies either a unique name or a 16-bit unsigned integer value that
identifies the resource.

optional-statements

Zero or more of the following statements:

Statement   Decription
CHARACTERISTICS dword User-defined information about a resource that can be
used by tools that read and write resource files.
LANGUAGE language, sublanguage  Specifies the language for the resource.
The parameters are constants from WINNLS.H.
VERSION dword   User-defined version number for the resource that can be used
by tools that read and write resource files.

event
Specifies the keystroke to be used as an accelerator.
It can be any one of the following character types:

"char"
A single character enclosed in double quotation marks.
The character can be preceded by a caret (^), meaning that the character is
a control character.

Character
An integer value representing a character. The type parameter must be ASCII.

Virtual-key character
An integer value representing a virtual key. The virtual key for alphanumeric
keys can be specified by placing the uppercase letter or number in double
quotation marks (for ex.., "9" or "C"). The type parameter must be VIRTKEY.

idvalue
Specifies a 16-bit unsigned integer value that identifies the accelerator.

type
Required only when the event parameter is a character or a virtual-key character.
The type parameter specifies either ASCII or VIRTKEY; the integer value of
event is interpreted accordingly.

When VIRTKEY is specified and event contains a string, event must be
uppercase.

options
Specifies the options that define the accelerator. This parameter can be one
or more of the following values:

NOINVERT
Specifies that no top-level menu item is highlighted when the accelerator
is used. This is useful when defining accelerators for actions such as
scrolling that do not correspond to a menu item. If NOINVERT is omitted,
a top-level menu item will be highlighted (if possible) when the accelerator
is used.

ALT
Causes the accelerator to be activated only if the ALT key is down.

SHIFT
Causes the accelerator to be activated only if the SHIFT key is down.

CONTROL
Defines the character as a control character (the accelerator is only
activated if the CONTROL key is down). This has the same effect as using a
caret (^) before the accelerator character in the event parameter.

The ALT, SHIFT, and CONTROL options apply only to virtual keys.

Example .. The following example demonstrates the use of accelerator keys:

1 ACCELERATORS
BEGIN
  "^C",  IDDCLEAR                         ; control C
  "K",   IDDCLEAR                         ; shift K
  "k",   IDDELLIPSE, ALT                  ; alt k
  98,    IDDRECT, ASCII                   ; b
  66,    IDDSTAR, ASCII                   ; B (shift b)
  "g",   IDDRECT                          ; g
  "G",   IDDSTAR                          ; G (shift G)
  VK_F1, IDDCLEAR,   VIRTKEY              ; F1
  VK_F1, IDDSTAR,    CONTROL,    VIRTKEY  ; control F1
  VK_F1, IDDELLIPSE, SHIFT  ,    VIRTKEY  ; shift F1
  VK_F1, IDDRECT,    ALT    ,    VIRTKEY  ; alt F1
  VK_F2, IDDCLEAR,   ALT, SHIFT, VIRTKEY  ; alt shift F2
  VK_F2, IDDSTAR, CONTROL, SHIFT,VIRTKEY  ; ctrl shift F2
  VK_F2, IDDRECT,   ALT, CONTROL,VIRTKEY  ; alt control F2
END
  Ne pas oublier de #define les VK_key ave avec leurs valeurs d'origines

AUTO3STATE Control
AUTO3STATE text, id, x, y, width, height [, style [, extended-style]]
The AUTO3STATE statement creates an automatic 3-state check box.
The control is an open box with the given text positioned to the right of
the box. When chosen, the box automatically advances between three states:
checked, unchecked, and disabled (grayed). The control sends a message to
its parent whenever the user chooses the control.

      Parameters

style
Specifies styles for the control, which can be a combination of the
BS_AUTO3STATE style and the following styles: WS_TABSTOP, WS_DISABLED,
and WS_GROUP.
The default style for this control is BS_AUTO3STATE and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and
extended-style parameters, see "
Common Statement Parameters".

See Also   AUTOCHECKBOX, CHECKBOX, CONTROL, STATE3

AUTOCHECKBOX Control

AUTOCHECKBOX text, id, x, y, width, height [, style [, extended-style]]
The AUTOCHECKBOX statement creates an automatic check box control.
The control is a small rectangle (check box) that has the specified text
displayed next to it (typically, to the right). When the user chooses the
control, the control highlights the rectangle and sends a message to its
parent window. The AUTOCHECKBOX statement, which can only be used in the
body of a DIALOG statement, defines the text, identifier, dimensions,
and attributes of the control.

Parameters

style
Specifies the styles of the control. This value can be a combination of the
button class style BS_AUTOCHECKBOX and the WS_TABSTOP and WS_GROUP styles.
If you do not specify a style, the default style is BS_AUTOCHECKBOX and
WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and
extended-style parameters, see "Common Statement Parameters".

See Also   AUTO3STATE, CHECKBOX, CONTROL, STATE3

AUTORADIOBUTTON Control

AUTORADIOBUTTON text, id, x, y, width, height [, style [, extended-style]]
The AUTORADIOBUTTON control statement specifies an automatic radio button control. This control automatically performs mutual exclusion with the other AUTORADIOBUTTON controls in the same group. When the button is chosen, the application is notified with BN_CLICKED

Parameters

text
The specified text appears next to the radio button.

style
Specifies styles for the automatic radio button, which can be a combination
of BUTTON-class styles and the following styles: WS_TABSTOP, WS_DISABLED,
and WS_GROUP.
The default style for AUTORADIOBUTTON is BS_AUTORADIOBUTTON and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and
extended-style parameters, see "Common Statement Parameters".

See Also  CONTROL, RADIOBUTTON

BITMAP Resource

nameID BITMAP [load-mem] filename

The BITMAP resource-definition statement specifies a bitmap that an
application uses in its screen display or as an item in a menu or control.

Parameters

nameID
Specifies either a unique name or a 16-bit unsigned integer value identifying
the resource.

load-mem
Specifies loading and memory attributes for the resource.
For more information, see "Common Resource Attributes".

filename
Specifies the name of the file that contains the resource.
The name must be a valid filename; it must be a full path if the file is
not in the current working directory. The path can either be a quoted or
non-quoted string.

Example .. The following example specifies two bitmap resources:

          disk1   BITMAP disk.bmp
          12      BITMAP PRELOAD diskette.bmp

See Also  LoadBitmap

CAPTION Statement

CAPTION captiontext
The CAPTION statement defines the title for a dialog box. The title appears in the box's caption bar (if it has one).
The default caption is empty.

Parameter

captiontext

Specifies a character string enclosed in double quotation marks.

Example

The following example demonstrates the use of the CAPTION statement:

CAPTION "Error!"

CHARACTERISTICS Statement
~~~~~~~~~~~~~~~~~~~~~~~~~~
CHARACTERISTICS dword
The CHARACTERISTICS statement allows the developer to specify information
about a resource that can be used by tools that read and write
resource-definition files. The specified dword value appears with the
resource in the compiled .RES file. However, the value is not stored in the
executable file and has no significance to Windows.

The CHARACTERISTICS statement appears before the BEGIN in an ACCELERATORS,
DIALOG, MENU, RCDATA, or STRINGTABLE resource definition.The specified value
applies only to that resource.

Parameter  dword

A user-defined doubleword value.

 CHECKBOX Control
 ~~~~~~~~~~~~~~~~
CHECKBOX text, id, x, y, width, height [, style [, extended-style]]
The CHECKBOX statement creates a check box control.
The control is a small rectangle (check box) that has the specified text
displayed next to it (typically, to the right). When the user selects the
control, the control highlights the rectangle and sends a message to its
parent window. The CHECKBOX statement, which can only be used in a DIALOG
statement, defines the text, identifier, dimensions, and attributes of the
control.

Parameters

text
Specifies text that is displayed to the right of the control.

style
Specifies the control styles. This value can be a combination of the button
class style BS_CHECKBOX and the WS_TABSTOP and WS_GROUP styles.If you do not
specify a style, the default style is BS_CHECKBOX and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and
extended-style parameters, see "Common Statement Parameters".

Example

This example creates a check-box control that is labeled "Italic":

CHECKBOX "Italic", 3, 10, 10, 40, 10

See Also AUTOCHECKBOX, AUTO3STATE, STATE3, GetDialogBaseUnits

CLASS Statement
~~~~~~~~~~~~~~~~
CLASS class
The CLASS statement defines the class of the dialog box. The CLASS statement appears in the optional section before a DIALOG statement's BEGIN keyword. If no class is given, the Windows standard dialog class is used.

Parameters

class
Specifies a 16-bit unsigned integer or a string, enclosed in double quotation marks, that identifies the class of the dialog box. If the window procedure for the class does not process a message sent to it, it must call the DefDlgProc function to ensure that all messages are handled properly for the dialog box. A private class can use DefDlgProc as the default window procedure. The class must be registered with the cbWndExtra member of the WNDCLASS structure set to DLGWINDOWEXTRA.

Comments
The CLASS statement should only be used with special cases, since it overrides the normal processing of a dialog box. The CLASS statement converts a dialog box to a window of the specified class; depending on the class, this could give undesirable results. Do not use the redefined control-class names with this statement.

Example
The following example demonstrates the use of the CLASS statement:

CLASS "myclass"

See Also    DIALOG, DefDlgProc

COMBOBOX Control
~~~~~~~~~~~~~~~~

COMBOBOX text, id, x, y, width, height [, style [, extended-style]]
The COMBOBOX statement creates a combination box control (a combo box). A combo box consists of either a static text box or an edit box combined with a list box. The list box can be displayed at all times or pulled down by the user. If the combo box contains a static text box, the text box always displays the selection (if any) in the list box portion of the combo box. If it uses an edit box, the user can type in the desired selection; the list box highlights the first item (if any) that matches what the user has entered in the edit box. The user can then select the item highlighted in the list box to complete the choice. In addition, the combo box can be owner-drawn and of fixed or variable height.

Parameters

style

Specifies the control styles. This value can be a combination of the COMBOBOX class styles and any of the following styles: WS_TABSTOP, WS_GROUP, WS_VSCROLL, and WS_DISABLED.
If you do not specify a style, the default style is CBS_SIMPLE and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "
Common Statement Parameters".

Example

This example creates a combo-box control with a vertical scroll bar:

COMBOBOX 777, 10, 10, 50, 54, CBS_SIMPLE | WS_VSCROLL | WS_TABSTOP

-----------------------------------------------------------------------------

                       CONTROL: General Control
                       ~~~~~~~~~~~~~~~~~~~~~~~~

CONTROL text, id, class, style, x, y, width, height [, extended-style]
This statement defines a user-defined control window.

Parameters

class

Specifies a redefined name, character string, a 16-bit unsigned integer value that defines the class. This can be any one of the control classes; for a list of the control classes, see the first list following this description. If the value is a redefined name supplied by the application, it must be a string enclosed in double quotation marks.

style

Specifies a redefined name or integer value that specifies the style of the given control. The exact meaning of style depends on the class value. the sections following this description show the control classes and corresponding styles.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "
Common Statement Parameters".
The six possible control classes are described in the following sections.

The Button Control Class
~~~~~~~~~~~~~~~~~~~~~~~~

A button control is a small rectangular child window that represents a "button" that the user can turn on or off by clicking it with the mouse. Button controls can be used alone or in groups, and can either be labeled or appear without text. Button controls typically change appearance when the user clicks them.
A button can have only one of the following styles, with the exception of BS_LEFTTEXTBS, which can be combined with check boxes and radio buttons.

BS_3STATE

Creates a button that is the same as a check box, except that the box can be grayed (dimmed) as well as checked. The grayed state is used to show that the state of the check box is not determined.

BS_AUTO3STATE

Creates a button that is the same as a three-state check box, except that the box changes its state when the user selects it. The state cycles through checked, grayed, and normal.

BS_AUTOCHECKBOX

Creates a button that is the same as a check box, except that an X appears in the check box when the user selects the box; the X disappears (is cleared) the next time the user selects the box.

BS_AUTORADIOBUTTON

Creates a button that is the same as a radio button, except that when the user selects it, the button automatically highlights itself and clears (removes the selection from) any other buttons in the same group.

BS_CHECKBOX

Creates a small square that has text displayed to its right (unless this style is combined with the BS_LEFTTEXT style).

BS_DEFPUSHBUTTON

Creates a button that has a heavy black border. The user can select this button by pressing the ENTER key. This style is useful for enabling the user to quickly select the most likely option (the default option).

BS_GROUPBOX

Creates a rectangle in which other controls can be grouped. Any text associated with this style is displayed in the rectangle's upper-left corner.

BS_LEFTTEXT

Places text on the left side of the radio button or check box when combined with a radio button or check box style.

BS_OWNERDRAW

Creates an owner-drawn button. The owner window receives a WM_MEASUREITEM message when the button is created, and it receives a WM_DRAWITEM message when a visual aspect of the button has changed. The BS_OWNERDRAW style cannot be combined with any other button styles.

BS_PUSHBUTTON

Creates a push button that posts a WM_COMMAND message to the owner window when the user selects the button.

BS_RADIOBUTTON

Creates a small circle that has text displayed to its right (unless this style is combined with the BS_LEFTTEXT style). Radio buttons are usually used in groups of related but mutually exclusive choices.

The Combobox Control Class

Combo-box controls consist of a selection field similar to an edit control plus a list box. The list box may be displayed at all times or may be dropped down when the user selects a "pop box" next to the selection field.
Depending on the style of the combo box, the user can or cannot edit the contents of the selection field. If the list box is visible, typing characters into the selection box will cause the first list-box entry that matches the characters typed to be highlighted. Conversely, selecting an item in the list box displays the selected text in the selection field. Combo-box control styles are described below.

CBS_SIMPLE

Displays the list box at all times. The current selection in the list box is displayed in the edit control.

CBS_DROPDOWN

Similar to CBS_SIMPLE except that the list box is not displayed unless the user selects an icon next to the selection field.

CBS_DROPDOWNLIST

Similar to CBS_DROPDOWN except that the edit control is replaced by a static text item which displays the current selection in the list box.

CBS_OWNERDRAWFIXED

Specifies a fixed-height owner-draw combo box. The owner of the list box is responsible for drawing its contents; the items in the list box are all the same height.

CBS_OWNERDRAWVARIABLE

Specifies a variable-height owner-draw combo box. The owner of the list box is responsible for drawing its contents; the items in the list box can have different heights.

CBS_AUTOHSCROLL

Scrolls the text in the edit control to the right when the user types a character at the end of the line. If this style is not set, only text that fits within the rectangular boundary is allowed.

CBS_SORT

Sorts strings entered into the list box.

CBS_HASSTRINGS

Specifies an owner-draw combo box that contains items consisting of strings. The combo box maintains the memory and pointers for the strings so that the application can use the LB_GETTEXT message to retrieve the text for a particular item.

CBS_OEMCONVERT

Converts text entered in the combo box edit control from the ANSI character set to the OEM character set and then back to ANSI. This ensures proper character conversion when the application calls the CharToOem function to convert an ANSI string in the combo box to OEM characters. This style is most useful for combo boxes that contain filenames and applies only to combo boxes created with the CBS_SIMPLE or CBS_DROPDOWN styles.

The Edit Control Class

An edit control is a rectangular child window in which the user can enter text from the keyboard. The user selects the control, and gives it the input focus, by clicking the mouse inside it or pressing the TAB key. The user can enter text when the control displays a flashing insertion point. The mouse can be used to move the cursor and select characters to be replaced, or to position the cursor for inserting characters. The BACKSPACE key can be used to delete characters.
Edit controls use the fixed-pitch font and display Unicode characters. They expand tab characters into as many space characters as are required to move the cursor to the next tab stop. Tab stops are assumed to be at every eighth character position. Edit control styles are described below.

ES_LEFT

Justifies the text to the left.

ES_CENTER

Centers the text. This style is valid in multiline edit controls only.

ES_RIGHT

Justifies the text to the right. This style is valid in multiline edit controls only.

ES_LOWERCASE

Converts all characters to lowercase as they are typed into the edit control.

ES_UPPERCASE

Converts all characters to uppercase as they are typed into the edit control.

ES_PASSWORD

Displays all characters as an asterisk (*) as they are typed into the edit control. An application can use the EM_SETPASSWORDCHAR message to change the character that is displayed.

ES_MULTILINE

Multiple-line edit control. (The default is single-line.) Shows as many lines of text as possible. The following four styles specify options for horizontal and vertical scrolling.

ES_AUTOVSCROLL specified

Shows as many lines as possible and scrolls vertically when the user presses the ENTER key. (This is actually the carriage-return character, which the edit control expands to a carriage-return/line-feed combination.)

ES_AUTOVSCROLL not specified

Shows as many lines as possible and beeps if the user presses ENTER when no more lines can be displayed.

ES_AUTOHSCROLL specified

Scrolls horizontally when the insertion point goes past the right edge of the control. To start a new line, press the ENTER key.

ES_AUTOHSCROLL not specified

Wraps words to the beginning of the next line when necessary. A new line is also started if the user presses ENTER. If the window size changes, the word wrap position changes, and the text is redisplayed.

Multiple-line edit controls can have scroll bars. An edit control with scroll bars processes its own scroll-bar messages. Edit controls without scroll bars scroll as described above, and process any scroll messages sent by the parent window.

ES_AUTOVSCROLL

Scrolls text automatically up one page when the user presses the ENTER key on the last line.

ES_AUTOHSCROLL

Scrolls text automatically to the right by 10 characters when the user types a character at the end of the line. When the user presses the ENTER key, the control scrolls all text back to position 0.

ES_NOHIDESEL

Overrides the default action, in which an edit control hides the selection when the control loses the input focus. Inverts the selection instead.

ES_OEMCONVERT

Converts text entered in the edit control from the ANSI character set to the OEM character set and then back to ANSI. This ensures proper character conversion when the application calls the CharToOem function to convert an ANSI string in the edit control to OEM characters. This style is most useful for edit controls that contain filenames.

The Listbox Control Class

Listbox controls consist of a list of character strings. The control is used whenever an application needs to present a list of names, such as filenames, that the user can view and select. The user can select a string by pointing to the string with the mouse and clicking a mouse button. When a string is selected, it is highlighted and a notification message is passed to the parent window. A scroll bar can be used with a listbox control to scroll lists that are too long or too wide for the control window. Listbox control styles are described below.

LBS_STANDARD

Strings in the list box are sorted alphabetically and the parent window receives an input message whenever the user clicks or double-clicks a string. The list box contains borders on all sides.

LBS_DISABLENOSCROLL

Shows a disabled vertical scroll bar for the list box when the box does not contain enough items to scroll. If this style is not specified, the scroll bar is hidden when the list box does not contain enough items.

LBS_EXTENDEDSEL

The user can select multiple items using the mouse with the SHIFT and/or the CONTROL key or special key combinations.

LBS_HASSTRINGS

An owner-draw list box contains items consisting of strings. The list box maintains the memory and pointers for the strings so the application can use the LB_GETTEXT message to retrieve the text for a particular item.

LBS_NOTIFY

The parent receives an input message whenever the user clicks or double-clicks a string.

LBS_MULTIPLESEL

The string selection is toggled each time the user clicks or double-clicks the string. Any number of strings can be selected.

LBS_MULTICOLUMN

The list box contains multiple columns. The list box can be scrolled horizontally. The LB_SETCOLUMNWIDTH message sets the width of the columns.

LBS_NOINTEGRALHEIGHT

The size of the list box is exactly the size specified by the application when it created the list box. Normally, Windows sizes a list box so that the list box does not display partial items.

LBS_SORT

The strings in the list box are sorted alphabetically.

LBS_NOREDRAW

The list-box display is not updated when changes are made. This style can be changed at any time by sending a WM_SETREDRAW message.

LBS_OWNERDRAWFIXED

The owner of the list box is responsible for drawing its contents; the items in the list box are all the same height.

LBS_OWNERDRAWVARIABLE

The owner of the list box is responsible for drawing its contents; the items in the list box are variable in height.

LBS_USETABSTOPS

The list box is able to recognize and expand tab characters when drawing its strings. The default tab positions are set at every 32 dialog units. (A dialog unit is a horizontal or vertical distance. One horizontal dialog unit is equal to 1/4 of the current dialog base width unit. The dialog base units are computed from the height and width of the current system font. The GetDialogBaseUnits function returns the size of the dialog base units in pixels.)

LBS_WANTKEYBOARDINPUT

The owner of the list box receives WM_VKEYTOITEM or WM_CHARTOITEM  messages whenever the user presses a key when the list box has input focus. This allows an application to perform  special processing on the keyboard input.

The Scrollbar Control Class

A scroll-bar control is a rectangle that contains a scroll  thumb and has direction arrows at both ends. The scroll bar sends  a notification message to its parent whenever the user clicks the  mouse in the control. The parent is responsible for updating the thumb  position, if necessary. Scroll-bar controls have the same appearance  and function as the scroll bars used in ordinary windows. But unlike  scroll bars, scroll-bar controls can be positioned anywhere within  a window and used whenever needed to provide scrolling input for a  window. Scroll bar control styles are described below.

SBS_VERT

Vertical scroll bar. If neither SBS_RIGHTALIGN nor SBS_LEFTALIGN  is specified, the scroll bar has the height, width, and position given  in the CreateWindow function.

SBS_RIGHTALIGN

Used with SBS_VERT. The right edge of the scroll bar is aligned  with the right edge of the rectangle specified by the x, y,  width, and height values given in the CreateWindow function. The scroll bar has the default width for system scroll bars.

SBS_LEFTALIGN

Used with SBS_VERT. The left edge of the scroll bar is aligned  with the left edge of the rectangle specified by the x, y,  width, and height values given in the CreateWindow function. The scroll bar has the default width for system scroll bars.

SBS_HORZ

Horizontal scroll bar. If neither SBS_BOTTOMALIGN nor SBS_TOPALIGN  is specified, the scroll bar has the height, width, and position given  in the CreateWindow function.

SBS_TOPALIGN

Used with SBS_HORZ. The top edge of the scroll bar is aligned  with the top edge of the rectangle specified by the x, y,  width, and height values given in the CreateWindow  function. The scroll bar has the default height for system scroll  bars.

SBS_BOTTOMALIGN

Used with SBS_HORZ. The bottom edge of the scroll bar is aligned  with the bottom edge of the rectangle specified by the x, y,  width, and height values given in the CreateWindow function. The scroll bar has the default height for system scroll  bars.

SBS_SIZEBOX

Size box. If neither SBS_SIZEBOXBOTTOMRIGHTALIGN nor SBS_SIZEBOXTOPLEFTALIGN  is specified, the size box has the height, width, and position given  in the CreateWindow function.

SBS_SIZEBOXTOPLEFTALIGN

Used with SBS_SIZEBOX. The top-left corner of the size box  is aligned with the top-left corner of the rectangle specified by  the x, y,  width, and height values given  in the CreateWindow function. The size box has the default size  for system size boxes.

SBS_SIZEBOXBOTTOMRIGHTALIGN

Used with SBS_SIZEBOX. The bottom-right corner of the size  box is aligned with the bottom-right corner of the rectangle specified  by the x, y, width, and height values  given in the CreateWindow function. The size box has the default  size for system size boxes.

The Static Control Class

Static controls are simple text fields, boxes, and rectangles  that can be used to label, box, or separate other controls. Static  controls take no input and provide no output. Static control styles  are described below.

SS_LEFT

A simple rectangle displaying the given text flush left. The  text is formatted before it is displayed. Words that would extend  past the end of a line are automatically wrapped to the beginning  of the next line.

SS_CENTER

A simple rectangle displaying the given text centered. The  text is formatted before it is displayed. Words that would extend  past the end of a line are automatically wrapped to the beginning  of the next line.

SS_RIGHT

A simple rectangle displaying the given text flush right.  The text is formatted before it is displayed. Words that would extend  past the end of a line are automatically wrapped to the beginning  of the next line.

SS_LEFTNOWORDWRAP

A simple rectangle displaying the given text flush left. Tabs  are expanded, but words are not wrapped. Text that extends past the  end of a line is clipped.

SS_SIMPLE

A simple rectangle with a single line of text flush left.  The line of text cannot be shortened or altered in any way. (The control's  parent window or dialog box must not process the WM_CTLCOLOR message.)

SS_NOPREFIX

Removes any (&) characters and underlines the next character  in the string. Unless this style is specified, Windows will interpret  any (&) characters in the control's text to be accelerator prefix  characters. If a static control is to contain text where this feature  is not wanted, SS_NOPREFIX may be added. This STATIC-control style  may be included with any of the defined STATIC controls.
You can combine SS_NOPREFIX with other styles by using the  bitwise OR operator. This is most often used when filenames  or other strings that may contain an (&) need to be displayed in a  static control in a dialog box.

SS_ICON

An icon displayed in the dialog box. The given text is the  name of an icon (not a filename) defined elsewhere in the resource  file. For the ICON statement, the width and height  parameters in the CreateWindow function are ignored; the  icon automatically sizes itself.

SS_BLACKRECT

A rectangle filled with the color used to draw window frames.  This color is black in the default Windows color scheme.

SS_GRAYRECT

A rectangle filled with the color used to fill the screen  background. This color is gray in the default Windows color scheme.

SS_WHITERECT

A rectangle filled with the color used to fill window backgrounds.  This color is white in the default Windows color scheme.

SS_BLACKFRAME

Box with a frame drawn with the same color as window frames.  This color is black in the default Windows color scheme.

SS_GRAYFRAME

Box with a frame drawn with the same color as the screen background  (desktop). This color is gray in the default Windows color scheme.

SS_WHITEFRAME

Box with a frame drawn with the same color as window backgrounds.  This color is white in the default Windows color scheme.

SS_USERITEM

User-defined item.

CTEXT Control
~~~~~~~~~~~~~~
CTEXT text, id, x, y, width, height [, style [, extended-style]]
The CTEXT statement creates a centered-text control. The control is a simple rectangle displaying the given text centered in the rectangle. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line. The CTEXT statement, which you can use only in a DIALOG statement, defines the text, identifier, dimensions, and attributes of the control.

Parameters

text
Specifies text that is centered in the rectangular area of the control.

style
Specifies the control styles. This value can be any combination of the following styles: SS_CENTER, WS_TABSTOP, and WS_GROUP.
If you do not specify a style, the default style is SS_CENTER and WS_GROUP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "
Common Statement Parameters".

Example

This example creates a centered-text control that is labeled "filename":

CTEXT "filename", 101, 10, 10, 100, 100

See Also CONTROL, DIALOG, LTEXT, RTEXT

CURSOR Resource
~~~~~~~~~~~~~~~~
nameID CURSOR [load-mem] filename

The CURSOR statement specifies a bitmap that defines the shape of the cursor
on the display screen.

Parameters

- nameID     Specifies either a unique name or a 16-bit unsigned integer
             identifying the resource.

- load-mem   Specifies loading and memory attributes for the resource.
             For more information, see "Common Resource Attributes".

- filename   Specifies the name of the file that contains the resource.
             The name must be a valid filename; it must be a full path if
             the file is not in the current working directory.
             The path can either be a quoted or non-quoted string.

Comments
Icon and cursor resources can contain more than one image.
If the resource is marked with the PRELOAD option, Windows loads all images
in the resource when the application executes.

Example
The following example specifies two cursor resources; one by name
(cursor1) and the other by number (2):

cursor1 CURSOR bullseye.cur
2       CURSOR "d:\\cursor\\arrow.cur"

DEFPUSHBUTTON Control

 DEFPUSHBUTTON text, id, x, y, width, height [, style [, extended-style]]
 The DEFPUSHBUTTON statement creates a default push-button control. The control is a small rectangle with a bold outline that represents the default response for the user. The given text is displayed inside the button. The control highlights the button in the usual way when the user clicks the mouse in it and sends a message to its parent window.

Parameters

text

Specifies text that is centered in the rectangular area of the control.

style

Specifies the control styles. This value can be a combination of the following styles: BS_DEFPUSHBUTTON, WS_TABSTOP, WS_GROUP, and WS_DISABLED.
If you do not specify a style, the default style is BS_DEFPUSHBUTTON and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "
Common Statement Parameters".

Example

This example creates a default push-button control that is labeled "Cancel":

DEFPUSHBUTTON "Cancel", 101, 10, 10, 24, 50

See Also  PUSHBUTTON, RADIOBUTTON

DIALOG Resource
~~~~~~~~~~~~~~~~
nameID DIALOG [load-mem] x , y, width, height

[   optional-statements]

BEGIN
    control-statement
    . . .
END

The DIALOG statement defines a window that an application can use to create
dialog boxes. The statement defines the position and dimensions of the dialog
box on the screen as well as the dialog box style.

nameID
- Identifies the dialog box. This is either a unique name or a unique 16-bit
  unsigned integer value in the range 1 to 65,535.

load-mem
- Specifies loading and memory attributes for the resource.
  For more information, see "Common Resource Attributes".

option-statements
- Specifies options for the dialog box.
  This can be zero or more of the following statements:

CAPTION "text"
- Specifies the caption of the dialog box if it has a title bar.
  See CAPTION for more information.

CHARACTERISTICS dword
- Specifies a user-defined double-word value for use by resource tools.
  This value is not used by Windows.
  See CHARACTERISTICS for more information,.

CLASS class
- Specifies a 16-bit unsigned integer or a string, enclosed in double
  quotation marks, that identifies the class of the dialog box.
  See CLASS for more information.

LANGUAGE language,sublanguage
- Specifies the language of the dialog box.
  See LANGUAGE for more information.

STYLE styles
- Specifies the styles of the dialog box.
  See STYLE for more information.

EXSTYLE=extended-styles
- Specifies the extended styles of the dialog box.
  See EXSTYLE for more information.

VERSION dword
- Specifies a user-defined doubleword value. This statement is intended for
  use by additional resource tools and is not used by Windows.
  See VERSION for more information.

- For more information on the x, y, width, and height parameters,
  see "Common Statement Parameters".

Comments

- The GetDialogBaseUnits function returns the dialog base units in pixels.
  The exact meaning of the coordinates depends on the style defined by the
  STYLE option statement. For child-style dialog boxes, the coordinates are
  relative to the origin of the parent window, unless the dialog box has the
  style DS_ABSALIGN; in that case, the coordinates are relative to the origin
  of the display screen.
- Do not use the WS_CHILD style with a modal dialog box.
  The DialogBox function always disables the parent/owner of the newly
  created dialog box. When a parent window is disabled, its child windows
  are implicitly disabled. Since the parent window of the child-style dialog
  box is disabled, the child-style dialog box is too.
- If a dialog box has the DS_ABSALIGN style, the dialog coordinates for its
  upper-left corner are relative to the screen origin instead of to the
  upper-left corner of the parent window. You would typically use this style
  when you wanted the dialog box to start in a specific part of the display
  no matter where the parent window may be on the screen.

- The name DIALOG can also be used as the class-name parameter to the
  CreateWindow function to create a window with dialog box attributes.

Example

The following demonstrates the usage of the DIALOG statement:

#include

ErrorDialog DIALOG  10, 10, 300, 110
STYLE WS_POPUP|WS_BORDER
CAPTION "Error!"
BEGIN
    CTEXT "Select One:", 1, 10, 10, 280, 12
    PUSHBUTTON "&Retry", 2, 75, 30, 60, 12
    PUSHBUTTON "&Abort", 3, 75, 50, 60, 12
    PUSHBUTTON "&Ignore", 4, 75, 80, 60, 12
END

See Also  CONTROL, CreateDialog, CreateWindow, DialogBox, GetDialogBaseUnits
          Multiline Statements
          CHARACTERISTICS, LANGUAGE, VERSION
          ACCELERATORS, DIALOG, MENU, RCDATA, STRINGTABLE

DIALOGEX Resource       (Long chapitre  115 lignes  Jmm)
~~~~~~~~~~~~~~~~~~

   The DIALOGEX resource is an extension of the DIALOG resource.
   In addition to the functionality offered by DIALOG, DIALOGEX allows
   for the following:

 · Help IDs on the dialog itself as well as on controls within the dialog.
 · Use of the EXSTYLE statement for the dialog itself as well as on
   controls  within the dialog.
 · Font weight and italic settings for the font to be used in the dialog.
 · Control-specific data for controls within the dialog.
 · Use of the BEDIT, IEDIT, and HEDIT predefined system class names.

-*- Syntax

      nameID DIALOGEX [ load-mem] x, y, width, height [ , helpID]
      [ optional-statements]
     BEGIN
           control-statement
           . . .
     END

-*- Parameters

 - nameID   Identifies the dialog box.
            This is either a unique name or a unique 16-bit unsigned integer
            value in the range 1 to 65,535.

 - load-mem  Specifies loading and memory attributes for the resource.
             For more information, see Common Resource Attributes.

 - x        Specifies the location on the screen of the left side of the
            dialog, in dialog units.

 - y        Specifies the location on the screen of the top of the dialog,
            in dialog units.

 - width    Specifies the width of the dialog, in dialog units.

 - height   Specifies the height of the dialog, in dialog units.

 - helpID   Specifies a numeric expression indicating the ID used to
            identify the dialog during WM_HELP processing.

 - optional-statements   Specifies options for the dialog box.
            This can be zero or more of the following statements:

 - CAPTION "text"
            Specifies the caption of the dialog box if it has a title bar.
            See CAPTION for more information.

 - CHARACTERISTICS DWORD
            Specifies a user-defined DWORD value for use by resource tools.
            This value is not used by Windows.
            For more information see CHARACTERISTICS
 - CLASS class
            Specifies a 16-bit unsigned integer or a string, enclosed in
            double quotation marks ("), that identifies the class of the
            dialog box. See CLASS for more information.

 - EXSTYLE=extended-styles
            Specifies the extended styles of the dialog box.
            See EXSTYLE for more information.

 - FONT pointsize, typeface, weight, italic

    -   pointsize   Specifies the size, in points, of the font.

    -   typeface    Specifies the name of the typeface.
                    This name must be identical to the name defined in the
                    [FONTS] section of WIN.INI.  This parameter must be
                    enclosed in double quotation marks (").

    -   weight      Specifies a numeric expression for the font weight
                    (explicit FW_* values defined in WINGDI.H can be used by
                    adding an include to the RC file: #include "WINGDI.H")

    -   italic      Indicates whether the font should be italic or not.
                    Specify either TRUE or FALSE for the italic value.

    -   LANGUAGE language, sublanguage
                    Specifies the language of the dialog box.
                    See LANGUAGE for more information.

    -  MENU menuname
                    Specifies the menu to use. This value is either the name
                    of the menu or the integer identifier.

    -  STYLE styles
                    Specifies the styles of the dialog box.
                    See STYLE for more information.

    - VERSION DWORD
                    Specifies a user-defined DWORD value. This statement is
                    intended for use by additional resource tools and is not
                    used by Windows. For more information, see VERSION

  The DIALOGEX body is marked with a BEGIN statement at the beginning of the
  body and an END statement at the end of the body. The body is made up of
  any number of control statements.
  There are four families of control statements:
  generic, static, button, and edit.
  While each of these families uses a different syntax for defining specific
  features of its controls, they all share a common syntax for defining the
  position, size, extended styles, help identification number, and
  control-specific data. That common syntax is:

    (controlType), x, y, cx, cy [, [exStyle] [, helpID]
    [BEGIN
        data-element-1 [,
        data-element-2 [,
        ... ]]
    END]

    (controlType)
    Family-specific definition ¾ described below.

 -  x
       Specifies the location in the dialog of the left side of the control,
       in dialog units.

 -  y
       Specifies the location in the dialog of the top of the control,
       in dialog units.

 - cx
       Specifies the width of the control, in dialog units.

 - cy
       Specifies the height of the control, in dialog units.

 - exStyle
       Specifies any number of extended window styles (explicit WS_EX_*
       style values defined in winuser.h can be used by adding an include
       to the RC file: #include "winuser.h")

 - helpID
       Specifies a numeric expression indicating the ID used to identify the
       control during WM_HELP processing.

 - controlData
       Marked by a nested BEGIN and END, specifies the control-specific data
       for the control. When a dialog is created, and a control in that
       dialog which has control-specific data is created, a pointer to that
       data is passed into the control's window procedure via the lParam to
       the WM_CREATE message for that control.

 Following is the family-specific syntax of the (controlType):

   Generic control:

   CONTROL controlText, id, className, style

   - controlText  Specifies the window text for the control.
                  For more information, see Common Statement Parameters.
   - id           Specifies the control identifier.
                  For more information, see Common Statement Parameters.
   - className    Specifies the name of the class. This may be either a
                  string enclosed in double quotation marks (") or one of
                  the following predefined system classes:
                  BUTTON, STATIC, EDIT, LISTBOX, SCROLLBAR, or COMBOBOX.
   - style        Specifies the window styles (explicit WS_*, BS_*, SS_*,
                  ES_*, LBS_*, SBS_*, and CBS_* style values defined in
                  WINUSER.H can be used by adding an include to the RC file:
                  #include "WINUSER.H")

   Static control:

   staticClass controlText, id

   staticClass {LTEXT | RTEXT | CTEXT}

   - controlText  Specifies the window text for the control.
                  For more information, see "Common Statement Parameters".
   - id           Specifies the control identifier.
                  For more information, see "Common Statement Parameters".

   Button control:

   buttonClass controlText, id

   buttonClass {AUTO3STATE | AUTOCHECKBOX | AUTORADIOBUTTON | CHECKBOX |
                PUSHBOX | PUSHBUTTON | RADIOBUTTON | STATE3 | USERBUTTON}

   - controlText  Specifies the window text for the control.
                  For more information, see "Common Statement Parameters".
   - id           Specifies the control identifier.
                  For more information, see "Common Statement Parameters".

  Edit control:

  editClass id

  editClass {EDITTEXT | BEDIT | HEDIT | IEDIT}

  id   Specifies the control identifier.
       For more information, see "Common Statement Parameters".

  Arithmetic and Boolean Operations
  Valid operations that may be contained in any of the numeric expressions
  in the statements of DIALOGEX are:

    ·   Add ('+')
    ·   Subtract ('-')
    ·   Unary minus ('-')
    ·   Unary NOT ('~')
    ·   AND ('&')
    ·   OR ('|')

See Also CONTROL, CreateDialog, CreateWindow, DialogBox, GetDialogBaseUnits,
         Multiline Statements, ACCELERATORS, CHARACTERISTICS, LANGUAGE,
         MENU, RCDATA, STRINGTABLE, VERSION

EDITTEXT Control
~~~~~~~~~~~~~~~~

     EDITTEXT text, id, x, y, width, height [, style [, extended-style]]

 The EDITTEXT statement defines an EDIT control belonging to the EDIT class.
 It creates a rectangular region in which the user can type and edit text.
 The control displays a cursor when the user clicks the mouse in it.
 The user can then use the keyboard to enter text or edit the existing text.
 Editing keys include the BACKSPACE and DELETE keys.
 The user can also use the mouse to select characters to be deleted or to
 select the place to insert new characters.

 Parameters

 style Specifies the control styles.
       This value can be a combination of the edit class styles and the
       following styles: WS_TABSTOP, WS_GROUP, WS_VSCROLL, WS_HSCROLL, and
       WS_DISABLED.
       If you do not specify a style, the default style is ES_LEFT,
       WS_BORDER, and WS_TABSTOP.

 For more information on the text, id, x, y, width, height, style, and
 extended-style parameters, see "Common Statement Parameters".

 Example ..
 The following example demonstrates the use of the EDITTEXT statement:

                    EDITTEXT  3, 10, 10, 100, 10

EXSTYLE Statement
~~~~~~~~~~~~~~~~~
 EXSTYLE extended-style
 The EXSTYLE command allows you to designate a dialog box with the
 WS_EX_style styles. In a resource definition, the EXSTYLE statement is
 placed with the optional statements before the BEGIN keyword.
 It can also be placed with the load-mem parameters in a DIALOG statement
 as follows:
             name DIALOG  [load-mem] EXSTYLE=extended-style  x, y, ...

 For controls, extended styles are specified after the style option in any
 control definition, as follows:

         control text, id, x, y, width, height, [style[, extended-style]]

 Parameters    extended-style

 The WS_EX_style style for the dialog box or control.

 See also    ACCELERATORS, CONTROL, DIALOG, MENU, POPUP, RCDATA,
             STRINGTABLE, User-Defined Resouce

FONT Resource
~~~~~~~~~~~~~~
nameID FONT [load-mem] filename
The FONT resource-definition statement specifies a file that contains a font.
For a font resource, nameID must be a number; it cannot be a name.

--Parameters

 nameID
 Specifies either a unique name or a 16-bit unsigned integer value identifying
 the resource.

 load-mem
 Specifies loading and memory attributes for the resource.
 For more information, see "Common Resource Attributes".

 filename
 Specifies the name of the file that contains the resource.
 The name must be a valid filename; it must be a full path if the file is not
 in the current working directory. The path can either be a quoted or
 non-quoted string.

- Example ..  The following example specifies a single font resource:

 5 FONT  CMROMAN.FNT

 See also  FONT Statement

FONT Statement
~~~~~~~~~~~~~~

 FONT pointsize, typeface

 The FONT statement defines the font with which Windows will draw text in
 the dialog box. The font must have been previously loaded, either from
 the WIN.INI file or by calling the LoadResource function.

- Parameters

  pointsize
  Specifies the size, in points, of the font.

  typeface
  Specifies the name of the typeface.
  This name must be identical to the name defined in the [fonts] section of
  WIN.INI. This parameter must be enclosed in double quotes.

- Example .. The following example demonstrates the use of the FONT statement:

  FONT 12, "MS Sans Serif"

  See Also   DIALOG, FONT Resource, LoadResource

GROUPBOX Control
~~~~~~~~~~~~~~~~~~

 GROUPBOX text, id, x, y, width, height [, style [, extended-style]]

 The GROUPBOX statement creates a group box control.
 The control is a rectangle that groups other controls together.
 The controls are grouped by drawing a border around them and displaying the
 given text in the upper-left corner.
 The GROUPBOX statement, which you can use only in a DIALOG statement,
 defines the text, identifier, dimensions, and attributes of a control window.
 When the style contains WS_TABSTOP or the text specifies an accelerator,
 tabbing or pressing the accelerator key moves the focus to the first control
 within the group.

- Parameters

 style
 Specifies the control styles. This value can be a combination of the button
 class style BS_GROUPBOX and the WS_TABSTOP and WS_DISABLED styles.
 If you do not specify a style, the default style is BS_GROUPBOX.

 For more information on the text, id, x, y, width, height, style, and
 extended-style parameters, see "Common Statement Parameters".

- Example ..This example creates a group-box control that is labeled Options:

 GROUPBOX "Options", 101, 10, 10, 100, 100

 See Also  DIALOG

ICON Resource
~~~~~~~~~~~~~~
nameID ICON [load-mem] filename
The ICON resource-definition statement specifies a bitmap that defines the
shape of the icon to be used for a given application.

Parameters

- nameID      Specifies either a unique name or a 16-bit unsigned integer
              value identifying the resource.
- load-mem    Specifies loading and memory attributes for the resource.
              For more information, see "Common Resource Attributes".
- filename    Specifies the name of the file that contains the resource.
              The name must be a valid filename;  it must be a full path
              if the file is not in the current working directory.
              The path can either be a quoted or non-quoted string.
Comments
Icon and cursor resources can contain more than one image.
If the resource is marked as PRELOAD, Windows loads all images in the
resource when the application executes.

Example .. The following example specifies two icon resources:

desk1   ICON desk.ico
11      ICON DISCARDABLE custom.ico

ICON Control
~~~~~~~~~~~~
ICON text, id, x, y, [width, height, style [, extended-style]]

The ICON statement creates an icon control. This control is an icon displayed
in a dialog box. The ICON control statement, which you can use only in a
DIALOG statement, defines the icon-resource identifier, icon-control
identifier, position, and attributes of a control.

- Parameters

 text
 Specifies the name of an icon (not a filename) defined elsewhere in the
 resource file.

 width
 This value is ignored and should be set to zero.

 height
 This value is ignored and should be set to zero.

 style
 Specifies the control style. This parameter is optional.
 The only value that can be specified is the SS_ICON style.
 This is the default style whether this parameter is specified or not.

 For more information on the text, id, x, y, width, height, style, and
 extended-style parameters, see "Common Statement Parameters".

 Example ..  This example creates an icon control whose icon identifier
            is 901 and whose name is "myicon":

            ICON "myicon" 901, 30, 30

See Also  DIALOG, ICON Resource

LANGUAGE Statement
~~~~~~~~~~~~~~~~~~
LANGUAGE language, sublanguage
The LANGUAGE statement sets the language for all resources up to the next
LANGUAGE statement or to the end of the file.
When the LANGUAGE statement appears before the BEGIN in an ACCELERATORS,
DIALOG, MENU, RCDATA, or STRINGTABLE resource definition, the specified
language applies only to that resource.

Parameters

language

Language identifier. Must be one of the constants from WINNLS.H

sublanguage

Sublanguage identifier. Must be one of the constants from WINNLS.H

See Also    Multiline Statements, CHARACTERISTICS, LANGUAGE, VERSION
            ACCELERATORS, DIALOG, MENU, RCDATA, STRINGTABLE

LISTBOX Control
~~~~~~~~~~~~~~~~
LISTBOX text, id, x, y, width, height [, style [, extended-style]]
The LISTBOX statement creates commonly used controls for a dialog box or window. The control is a rectangle containing a list of strings (such as filenames) from which the user can select. The LISTBOX statement, which can only be used in a DIALOG or WINDOW statement, defines the identifier, dimensions, and attributes of a control window.

Parameters

style

Specifies the control styles. This value can be a combination of the list-box class styles and any of the following styles: WS_BORDER and WS_VSCROLL.
If you do not specify a style, the default style is LBS_NOTIFY and WS_BORDER.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "Common Statement Parameters".

Example

This example creates a list-box control whose identifier is 101:

LISTBOX 101, 10, 10, 100, 100

See Also   COMBOBOX, DIALOG

LTEXT Control

LTEXT text, id, x, y, width, height [, style [, extended-style]]
The LTEXT statement creates a left-aligned text control. The control is a simple rectangle displaying the given text left-aligned in the rectangle. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line. The LTEXT statement, which can be used only in a DIALOG statement, defines the text, identifier, dimensions, and attributes of the control.

Parameters

style

Specifies the control styles. This value can be any combination of the BS_RADIOBUTTON style and the following styles: SS_LEFT, WS_TABSTOP, and WS_GROUP.
If you do not specify a style, the default style is SS_LEFT and WS_GROUP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "
Common Statement Parameters".

Example

This example creates a left-aligned text control that is labeled "Filename":

LTEXT "Filename", 101, 10, 10, 100, 100

See Also

CONTROL, DIALOG, CTEXT, RTEXT

MENU Resource                                          ; IDentificateur
~~~~~~~~~~~~~~
menuID MENU [load-mem]  [optional-statements]
BEGIN
    item-definitions
    . . .
END
The MENU statement defines the contents of a menu resource.
A menu resource is a collection of information that defines the appearance
and function of an application menu. A menu is a special input tool that
lets a user select commands from a list of command names.

Parameters

menuID
Identifies the menu. This value is either a unique string or a unique 16-bit
unsigned integer value in the range of 1 to 65,535.

load-mem
Specifies loading and memory attributes for the resource.
For more information, see "Common Resource Attributes".

optional-statements

Zero or more of the following statements:

Statement   Decription
CHARACTERISTICS dword   User-defined information about a resource that can
be used by tools that read and write resource files.
LANGUAGE language, sublanguage  Specifies the language for the resource.
The parameters are constants from WINNLS.H. VERSION dword   User-defined
version number for the resource that can be used by tools that read and
write resource files.

Example .. Following is an example of a complete MENU statement:

sample MENU  (,GRAYED       jmm pour optional-stat. voir PaintBrush31)
BEGIN
     MENUITEM "&Soup", 100
     MENUITEM "S&alad", 101
     POPUP "&Entree"
     BEGIN
          MENUITEM "&Fish", 200
          MENUITEM "&Chicken", 201, CHECKED
          POPUP "&Beef"
          BEGIN
               MENUITEM "&Steak", 301
               MENUITEM "&Prime Rib", 302
          END
     END
     MENUITEM "&Dessert", 103
END

See Also   MENUITEM, POPUP Multiline Statements CHARACTERISTICS, LANGUAGE,
           VERSION ACCELERATORS, DIALOG, MENU, RCDATA, STRINGTABLE

MENU Statement
~~~~~~~~~~~~~~
MENU menuname
The MENU statement defines the dialog box's menu. If no statement is given,
the dialog box has no menu.

Parameter

menuname
Specifies the menu to use. This value is either the name of the menu or the
integer identifier of the menu.

Example
The following example demonstrates the use of the MENU dialog statement:

MENU errmenu

MENUEX Statement      MENUEX Resource (2 titres ??)
~~~~~~~~~~~~~~~~

The MENUEX resource is an extension of the MENU resource. In addition to the
functionality offered by MENU, MENUEX allows for the following:

·   Help IDs on popup menus.
·   IDs on popup menus.
·   Use of the menu type and state flags created for Windows 95
    (MFT_* type flags and MFS_* state flags).

Syntax

menuID MENUEX
BEGIN
    [{[MENUITEM itemText [, [id] [, [type] [, state]]]] |
      [POPUP    itemText [, [id] [, [type] [,[state] [, helpID]]]]
    BEGIN
        popupBody
    END]} ...]
END

Parameters

MENUITEM statement

Defines a normal menu item

itemText
 Specifies the string containing the text for the menu item.
 For more information, see MENUITEM.

id
 Specifies a numeric expression indicating the ID of the menu item.

type
 Specifies a numeric expression indicating the type of the menu item
 (explicit MFT_* type values defined in WINUSER.H can be used by adding an
 include to the RC file: #include "WINUSER.H")

state
 Specifies a numeric expression indicating the state of the menu item
 (explicit MFS_* state values defined in WINUSER.H can be used by adding an
 include to the RC file: #include "WINUSER.H")

POPUP statement
 Defines a menu item which has another menu (a submenu) associated with it.

itemText
 Specifies a string containing the text for the menu item.

id
 Specifies a numeric expression indicating the ID of the menu item.

type
 Specifies a numeric expression indicating the type of the menu item
 (explicit MFT_* type values defined in WINUSER.H can be used by adding an
 include to the RC file: #include "WINUSER.H").

state
 Specifies a numeric expression indicating the state of the menu item
 (explicit MFS_* state values defined in WINUSER.H can be used by adding an
 include to the RC file: #include "WINUSER.H").

helpID
 Specifies a numeric expression indicating the ID used to identify the menu
 during WM_HELP processing.

popupBody
 Contain any combination of the MENUITEM and POPUP statements described above.

Remarks
 Valid arithmetic and Boolean operations that may be contained in any of the
 numeric expressions in the statements of MENUEX are:

 ·  Add ('+')
 ·  Subtract ('-')
 ·  Unary minus ('-')
 ·  Unary NOT ('~')
 ·  AND ('&')
 ·  OR ('|')

See Also   MENU, MENUITEM, POPUP  Multiline Statements ACCELERATORS,
           CHARACTERISTICS, DIALOG, LANGUAGE, RCDATA, STRINGTABLE,VERSION

MENUITEM Statement
~~~~~~~~~~~~~~~~~~
MENUITEM text, result, [optionlist]
MENUITEM SEPARATOR
The MENUITEM statement defines a menu item.

- Parameters

text
Specifies the name of the menu item.
The string can contain the escape characters \t and \a.
The \t character inserts a tab in the string and is used to align text in
columns.Tab characters should be used only in pop-up menus, not in menu bars.
(For information on pop-up menus, see the POPUP statement.)
The \a character aligns all text that follows it flush right to the menu
bar or pop-up menu.

- result
Specifies the result generated when the user selects the menu item.
This parameter takes an integer value. Menu-item results are always integers;
when the user clicks the menu-item name, the result is sent to the window
that owns the menu.

- optionlist
Specifies the appearance of the menu item. This optional parameter takes one
or more redefined menu options, separated by commas or spaces.
The menu options are as follows:

CHECKED
Item has a check mark next to it.

GRAYED
Item name is initially inactive and appears on the menu in gray or a
lightened shade of the menu-text color.

HELP
Identifies a help item.

INACTIVE
Item name is displayed but it cannot be selected.

MENUBARBREAK
Same as MF_MENUBREAK except that for pop-up menus, it separates the new
column from the old column with a vertical line.

MENUBREAK
Places the menu item on a new line for static menu-bar items.
For pop-up menus, it places the menu item in a new column with no dividing
line between the columns.

The INACTIVE and GRAYED options cannot be used together.

SEPARATOR
The MENUITEM SEPARATOR form of the MENUITEM statement creates an inactive
menu item that serves as a dividing bar between two active menu items in a
pop-up menu.

Example
The following example demonstrates the use of the MENUITEM and MENUITEM
SEPARATOR statements:

 MENUITEM "&Roman", 206, CHECKED, GRAYED
 MENUITEM SEPARATOR
 MENUITEM "&Blackletter", 301

See Also  MENU, POPUP  ---------------------------------------------------

MESSAGETABLE Resource
~~~~~~~~~~~~~~~~~~~~~~
nameID MESSAGETABLE filename
The MESSAGETABLE resource-deinition statement defines the ID and file of an
application's message table resource. Message tables are special string
resources used in event logging and with the FormatMessage API.
The file contains a binary message table generated by the Message Compiler.
The Message Compiler also generates a resource script file that contains the
MESSAGETABLE statements you need to include the message table resources in
the compiled resource file. Use the #include directive to include this
resource script into your main resource script.

Parameters

nameID
Specifies either a unique name or a 16-bit unsigned integer value
identifying the resource.

filename
Specifies the name of the file that contains the resource.
The name must be a valid filename; it must be a full path if the file is not
in the current working directory. The path can either be a quoted or
non-quoted string.

See Also   STRINGTABLE Resource, Message Compiler

POPUP Resource
~~~~~~~~~~~~~~~~
POPUP text, [optionlist]
BEGIN
    item-definitions
    .
    .
    .
END
The POPUP statement marks the beginning of the definition of a pop-up menu.
A pop-up menu (which is also known as a drop-down menu) is a special menu
item that displays a sublist of menu items when it is selected.

Parameters

text
Specifies the name of the pop-up menu. This string must be enclosed in
double quotation marks.

optionlist
Specifies one or more redefined menu options that specify the appearance of
the menu item. The menu options follow:

CHECKED
Item has a check mark next to it. This option is not valid for a top-level
pop-up menu.

GRAYED
Item name is initially inactive and appears on the menu in gray or a
lightened shade of the menu-text color.

INACTIVE
Item name is displayed but it cannot be selected.

MENUBARBREAK
Same as MF_MENUBREAK except that for pop-up menus, it separates the new
column from the old column with a vertical line.

MENUBREAK
Places the menu item on a new line for static menu-bar items.
For pop-up menus, it places the menu item in a new column with no dividing
line between the columns.

The INACTIVE and GRAYED options cannot be used together.

Example .. The following example demonstrates the use of the POPUP statement:

chem MENU
BEGIN
    POPUP "&Elements"
    BEGIN
         MENUITEM "&Oxygen", 200
         MENUITEM "&Carbon", 201, CHECKED
         MENUITEM "&Hydrogen", 202
         MENUITEM SEPARATOR
         MENUITEM "&Sulfur", 203
         MENUITEM "Ch&lorine", 204
    END
    POPUP "&Compounds"
    BEGIN
         POPUP "&Sugars"
         BEGIN
            MENUITEM "&Glucose", 301
            MENUITEM "&Sucrose", 302, CHECKED
            MENUITEM "&Lactose", 303, MENUBREAK
            MENUITEM "&Fructose", 304
         END
         POPUP "&Acids"
         BEGIN
              "&Hydrochloric", 401
              "&Sulfuric", 402
         END
    END
END

See Also   MENU, MENUITEM

PUSHBOX Control
~~~~~~~~~~~~~~~~

    PUSHBOX text, id, x, y, width, height [, style [, extended-style]]

The PUSHBOX statement creates a push-box control. Identical to a PUSHBUTTON,
except that it does not display a button face or frame;only the text appears.

Parameters

style
- Specifies styles for the pushbox, which can be a combination of the
  BS_PUSHBOX style and the following styles: WS_TABSTOP, WS_DISABLED,
  and WS_GROUP.

  The default style is BS_PUSHBOX and WS_TABSTOP.

- For more information on the text, id, x, y, width, height, style, and
  extended-style parameters, see "Common Statement Parameters".

See Also   PUSHBUTTON

PUSHBUTTON Control
~~~~~~~~~~~~~~~~~~

     PUSHBUTTON text, id, x, y, width, height [, style [, extended-style]]

 The PUSHBUTTON statement creates a push-button control.
 The control is a round-cornered rectangle containing the given text.
 The text is centered in the control.
 The control sends a message to its parent whenever the user chooses
 the control.

Parameters

- style  Specifies styles for the pushbutton, which can be a combination of
  the BS_PUSHBUTTON style and the following styles: WS_TABSTOP, WS_DISABLED,
  and WS_GROUP.
  The default style is BS_PUSHBUTTON and WS_TABSTOP.

- For more information on the text, id, x, y, width, height, style, and
  extended-style parameters, see "Common Statement Parameters".

Example

The following example demonstrates the use of the PUSHBUTTON statement:

PUSHBUTTON "ON", 7, 10, 10, 20, 10

See Also  GetDialogBaseUnits

RADIOBUTTON Control
~~~~~~~~~~~~~~~~~~~~

   RADIOBUTTON text, id, x, y, width, height [, style [, extended-style]]

The RADIOBUTTON statement creates a radio-button control. The control is a
small circle that has the given text displayed next to it, typically to its
right. The control highlights the circle and sends a message to its parent
window when the user selects the button. The control removes the highlight
and sends a message when the button is next selected.

Parameters

- style  Specifies styles for the radio button, which can be a combination
  of BUTTON-class styles and the following styles:
  WS_TABSTOP, WS_DISABLED, and WS_GROUP.

- The default style for RADIOBUTTON is BS_RADIOBUTTON and WS_TABSTOP.

- For more information on the text, id, x, y, width, height, style, and
  extended-style parameters, see "Common Statement Parameters".

Example

The following example demonstrates the use of the RADIOBUTTON statement:

RADIOBUTTON "Italic", 100, 10, 10, 40, 10

See Also  GetDialogBaseUnits

RCDATA Resource
~~~~~~~~~~~~~~~~
nameID RCDATA [load-mem] [optional-statements]
BEGIN
    raw-data
    . . .
END
The RCDATA statement defines a raw data resource for an application.
Raw data resources permit the inclusion of binary data directly in the
executable file.

Parameters

nameID
Specifies either a unique name or a 16-bit unsigned integer value that
identifies the resource.

load-mem
Specifies loading and memory attributes for the resource.
For more information, see "Common Resource Attributes".

optional-statements
Zero or more of the following statements:

Statement   Decription
CHARACTERISTICS dword   User-defined information about a resource that can
be used by tools that read and write resource files.
LANGUAGE language, sublanguage  Specifies the language for the resource.
The parameters are constants from WINNLS.H.
VERSION dword   User-defined version number for the resource that can be
used by tools that read and write resource files.

raw-data
Specifies raw data consisting of one or more integers or strings of characters. Integers can be specified in decimal, octal, or hexadecimal format. RC does not automatically append a terminating null character to a string. The string is a sequence of the specified ANSI (byte) characters unless explicitly qualified as a wide-character string with the L prefix. Strings in all resources other than RCDATA and user-defined resources are Unicode strings.
The block of data begins on a DWORD boundary and RC performs no padding or alignment of data within the raw-data block. It is the programmer's responsibility to ensure the proper alignment of data within the block.

Example ..
The following example demonstrates the use of the RCDATA statement:

resname RCDATA
BEGIN
   L"Here is a Unicode string\0", /* A Unicode string. Note: explicitly
                                 null-terminated */
   1024,                  /* int        */
   0x029a,                /* hex int    */
   0o733,                 /* octal int  */
   "\07"                  /* octal byte */
END

See Also  Multiline Statements CHARACTERISTICS, LANGUAGE, VERSION
          ACCELERATORS, DIALOG, MENU, RCDATA, STRINGTABLE

RTEXT Control
~~~~~~~~~~~~~~

   RTEXT text, id, x, y, width, height [, style [, extended-style]]

- The RTEXT statement creates a right-aligned text control. The control is a
  simple rectangle displaying the given text right-aligned in the rectangle.
  The text is formatted before it is displayed. Words that would extend past
  the end of a line are automatically wrapped to the beginning of the next line.

Parameters

- style  Specifies styles for the text control, which can be any combination
         of the following: WS_TABSTOP and WS_GROUP.
         The default style for RTEXT is SS_RIGHT and WS_GROUP.
      -  For more information on the text, id, x, y, width, height, style,
         and extended-style parameters, see "Common Statement Parameters".

Example  The following example demonstrates the use of the RTEXT statement:

         RTEXT "Number of Messages", 4, 30, 50, 100, 10

See Also  CONTROL, CTEXT, DIALOG, LTEXT

SCROLLBAR Control
~~~~~~~~~~~~~~~~~~
SCROLLBAR text, id, x, y, width, height [, style [, extended-style]]
The SCROLLBAR statement creates a scroll-bar control.
The control is a rectangle that contains a scroll box and has direction
arrows at both ends. The scroll-bar control sends a notification message
to its parent whenever the user clicks the mouse in the control.
The parent is responsible for updating the scroll-box position.
Scroll-bar controls can be positioned anywhere in a window and used whenever
needed to provide scrolling input.

Parameters

style
Specifies a combination (or none) of the following styles: WS_TABSTOP,
WS_GROUP, and WS_DISABLED.
In addition to these styles, the style parameter may contain a combination
(or none) of the SCROLLBAR-class styles.
The default style for SCROLLBAR is SBS_HORZ.

For more information on the text, id, x, y, width, height, style, and
extended-style parameters, see "Common Statement Parameters".

Example
The following example demonstrates the use of the SCROLLBAR statement:

SCROLLBAR 999, 25, 30, 10, 100

STATE3 Control
~~~~~~~~~~~~~~~~
STATE3  text, id, x, y, width, height [, style [, extended-style]]
The STATE3 statement defines a 3-state check box control.
The control is identical to a CHECKBOX, except that it has three states:
checked, unchecked, and disabled (grayed).

Parameters

text
Specifies text that is displayed to the right of the control.

style
Specifies the control styles. This value can be a combination of the button
class style BS_3STATE and the WS_TABSTOP and WS_GROUP styles.
If you do not specify a style, the default style is BS_3STATE and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and
extended-style parameters, see "Common Statement Parameters".

See Also  AUTOCHECKBOX, CHECKBOX, CONTROL

STRINGTABLE Resource
~~~~~~~~~~~~~~~~~~~~~~

STRINGTABLE [load-mem] [optional-statements]
BEGIN
    stringID string
    . . .
END

The STRINGTABLE statement defines one or more string resources for an
application. String resources are simply null-terminated Unicode strings
that can be loaded when needed from the executable file, using the LoadString
function.

Parameter

load-mem
Specifies loading and memory attributes for the resource.
For more information, see "Common Resource Attributes".

optional-statements
Zero or more of the following statements:

Statement   Decription
CHARACTERISTICS dword   User-defined information about a resource that can
be used by tools that read and write resource files.
ANGUAGE language, sublanguage   Specifies the language for the resource.
The parameters are constants from WINNLS.H.
VERSION dword   User-defined version number for the resource that can be
used by tools that read and write resource files.

stringID
Specifies an unsigned 16-bit integer that identifies the resource.

string
Specifies one or more strings, enclosed in double quotation marks.
The string must be no longer than 255 characters and must occupy a single
line in the source file. To add a carriage return to the string, use this
character sequence: \012. For example, "Line one\012Line two" would define
a string that would be displayed as follows:

Line one
Line two

Comments
rouping strings in separate sections allows all related strings to be read
in at one time and discarded together. When possible, an application should
make the table movable and discardable. RC allocates 16 strings per section
and uses the identifier value to determine which section is to contain the
string. Strings with the same upper-12 bits in their identifiers are placed
in the same section.

Example
The following example demonstrates the use of the STRINGTABLE statement:

#define IDS_HELLO    1
#define IDS_GOODBYE  2

STRINGTABLE
BEGIN
    IDS_HELLO,   "Hello"
    IDS_GOODBYE, "Goodbye"
END

See Also    Multiline Statements CHARACTERISTICS, LANGUAGE, VERSION
            ACCELERATORS, DIALOG, MENU, RCDATA, STRINGTABLE

STYLE Statement
~~~~~~~~~~~~~~~~
- STYLE style
  The STYLE statement defines the window style of the dialog box.
  The window style specifies whether the box is a pop-up or a child window.
  The default style has the following attributes:
  WS_POPUP, WS_BORDER, and WS_SYSMENU.

  Parameter
            style   Specifies the window style.
            ~~~~~   This parameter takes an integer value or redefined name.
                    The following lists the redefined styles:

DS_LOCALEDIT

  Specifies that edit controls in the dialog box will use memory in the
  application's data section. By default, all edit controls in dialog boxes
  use memory outside the application's data section. This feature can be
  suppressed by adding the DS_LOCALEDIT flag to the STYLE command for the
  dialog box. If this flag is not used, EM_GETHANDLE and EM_SETHANDLE
  messages must not be used since the storage for the control is not in the
  application's data section. This feature does not affect edit controls
  created outside of dialog boxes.

DS_MODALFRAME

 Creates a dialog box with a modal dialog box frame that can be combined with
 a title bar and System menu by specifying the WS_CAPTION et WS_SYSMENU styles.

DS_NOIDLEMSG

  Suppresses WM_ENTERIDLE messages that Windows would otherwise send to the
  owner of the dialog box while the dialog box is displayed.

DS_SYSMODAL

  Creates a system-modal dialog box.

WS_BORDER

  Creates a window that has a border.

WS_CAPTION

  Creates a window that has a title bar (implies the WS_BORDER style).

WS_CHILD

  Creates a child window. It cannot be used with the WS_POPUP style.

WS_CHILDWINDOW

  Creates a child window that has the WS_CHILD style.

WS_CLIPCHILDREN

  Excludes the area occupied by child windows when drawing within the parent
  window. Used when creating the parent window.

WS_CLIPSIBLINGS

  Clips child windows relative to each other; that is, when a particular
  child window receives a WM_PAINT message, this style clips all other
  top-level child windows out of the region of the child window to be
  updated. (If the WS_CLIPSIBLINGS style is not given and child windows
  overlap, it is possible, when drawing in the client area of a child window,
  to draw in the client area of a neighboring child window.)
  For use with the  WS_CHILD style only.

WS_DISABLED

  Creates a window that is initially disabled.

WS_DLGFRAME

  Creates a window with a modal dialog box frame but no title.

WS_GROUP

  Specifies the first control of a group of controls in which the user can
  move from one control to the next by using the arrow keys.
  All controls defined with the WS_GROUP style after the first control
  belong to the same group.
  The next control with the WS_GROUP style ends the style group and starts
  the next group (that is, one group ends where the next begins).
  This style is valid only for controls.

WS_HSCROLL

  Creates a window that has a horizontal scroll bar.

WS_ICONIC

  Creates a window that is initially iconic.
  For use with the WS_OVERLAPPED style only.

WS_MAXIMIZE

  Creates a window of maximum size.

WS_MAXIMIZEBOX

  Creates a window that has a Maximize box.

WS_MINIMIZE

  Creates a window of minimum size.

WS_MINIMIZEBOX

  Creates a window that has a Minimize box.

WS_OVERLAPPED

 Creates an overlapped window.An overlapped window has a caption and a border.

WS_OVERLAPPEDWINDOW

 Creates an overlapped window having the WS_OVERLAPPED,WS_CAPTION,WS_SYSMENU,
 WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles.

WS_POPUP

 Creates a pop-up window. It cannot be used with the WS_CHILD style.

WS_POPUPWINDOW

 Creates a pop-up window that has the WS_POPUP, WS_BORDER, and WS_SYSMENU
 styles. The WS_CAPTION style must be combined with the WS_POPUPWINDOW style
 to make the System menu visible.

WS_SIZEBOX

 Creates a window that has a size box. Used only for windows with a title
 bar or with vertical and horizontal scroll bars.

WS_SYSMENU

 Creates a window that has a System-menu box in its title bar.
 Used only for windows with title bars. If used with a child window,
 this style creates a Close box instead of a System-menu box.

WS_TABSTOP

 Specifies one of any number of controls through which the user can move
 by using the TAB key. The TAB key moves the user to the next control
 specified by the WS_TABSTOP style. This style is valid only for controls.

WS_THICKFRAME

 Creates a window with a thick frame that can be used to size the window.

WS_VISIBLE

 Creates a window that is initially visible.  This applies to overlapping
 and pop-up windows. For overlapping windows, the y parameter is used as a
 parameter for the ShowWindow function.

WS_VSCROLL

 Creates a window that has a vertical scroll bar.

Comments .. If the redefined names are used, you must include WINDOWS.H.

User-Defined Resource
~~~~~~~~~~~~~~~~~~~~~~
nameID typeID [load-mem] filename

  The filename specifies the name of a file containing the binary data of
  the resource. The contents of the file are included as the resource.
  RC does not interpret the binary data in any way. It is the programmer's
  responsibility to ensure that the data is properly aligned for the target
  machine architecture.
  A user-defined resource can also be defined completely in the resource
  script using the syntax:

nameID typeID [load-mem]
BEGIN
    raw-data
END

A user-defined resource statement specifies a resource that contains
application-specific data. The data can have any format and can be defined
either as the content of a given file (if the filename parameter is given)
or as a series of numbers and strings (if the raw-data block is given).

-- Parameters

- nameID   Specifies either a unique name or a 16-bit unsigned integer that
           identifies the resource.
- typeID   Specifies either a unique name or a 16-bit unsigned integer that
           identifies the resource type. If a number is given, it must be
           greater than 255. The numbers 1 through 255 are reserved for
           existing and future redefined resource types.
- load-mem Specifies loading and memory attributes for the resource.
           For more information, see "Common Resource Attributes".
- filename Specifies the name of the file that contains the resource data.
           The parameter must be a valid filename; it must be a full path if
           the file is not in the current working directory.
- raw-data Specifies raw data consisting of one or more integers or strings
           of characters. Integers can be specified in decimal, octal, or
           hexadecimal format. RC does not automatically append a terminating
           null character to a string. The string is a sequence of the
           specified ANSI (byte) characters unless explicitly qualified as a
           wide-character string with the L prefix. Strings in all resources
           other than RCDATA and user-defined resources are Unicode strings.
           - The block of data begins on a DWORD boundary and RC performs no
           padding or alignment of data within the raw-data block. It is the
           programmer's responsibility to ensure the proper alignment of data
           within the block.

Example .. The following example shows several user-defined statements:

array   MYRES   data.res
14      300     custom.res
18 MYRES2
BEGIN
  "Here is a data string\0", /* A string. Note: explicitly
                                null-terminated */
   1024,                     /* int        */
   0x029a,                   /* hex int    */
   0o733,                    /* octal int  */
   "\07"                     /* octal byte */
END

VERSION Statement
~~~~~~~~~~~~~~~~~
VERSION dword
The VERSION statement allows the developer to specify version information about a resource that can be used by tools that read and write resource files. The specified dword value appears with the resource in the compiled .RES file. However, the value is not stored in the executable file and has no significance to Windows.
The VERSION statement appears before the BEGIN in an ACCELERATORS, DIALOG, MENU, RCDATA, or STRINGTABLE resource definition. The specified value applies only to that resource.

Parameter

dword

A user-defined doubleword value.

See Also

Multiline Statements
CHARACTERISTICS, LANGUAGE, VERSION
ACCELERATORS, DIALOG, MENU, RCDATA, STRINGTABLE

VERSIONINFO Resource

versionID VERSIONINFO fixed-info
BEGIN
    block-statement
    . . .
END
The VERSIONINFO statement creates a version-information resource.
The resource contains such information about the file as its version number,
its intended operating system, and its original filename.
The resource is intended to be used with the File Installation library
functions.

Parameters

versionID

Specifies the version-information resource identifier. This value must be 1.

fixed-info

Specifies the version information, such as the file version and the intended operating system. This parameter consists of the following statements:

FILEVERSION version

Specifies the binary version number for the file. The version consists of two 32-bit integers, defined by four 16-bit integers. For example, FILEVERSION 3,10,0,61 is translated into two doublewords: 0x0003000a and 0x0000003d, in that order. Therefore, if version is defined by the doublewords dw1 and dw2, they need to appear in the FILEVERSION statement as follows: HIWORD(dw1), LOWORD(dw1), HIWORD(dw2), LOWORD(dw2).

PRODUCTVERSION version

Specifies the binary version number for the product with which the file is distributed. The version parameter is two 32-bit integers, defined by four 16-bit integers. For more information about version
, see the FILEVERSION description.

FILEFLAGSMASK fileflagsmask

Specifies which bits in the FILEFLAGS statement are valid. If a bit is set, the corresponding bit in FILEFLAGS is valid.

FILEFLAGS fileflags

Specifies the Boolean attributes of the file. The fileflags parameter must be the combination of all the file flags that are valid at compile time. For Windows 3.1, this value is 0x3f.

FILEOS fileos

Specifies the operating system for which this file was designed. The fileos parameter can be one of the operating system values given in the Comments section.

FILETYPE filetype

Specifies the general type of file. The filetype parameter can be one of the file type values listed in the Comments section.

FILESUBTYPE subtype

Specifies the function of the file. The subtype parameter is zero unless the type parameter in the FILETYPE statement is VFT_DRV, VFT_FONT, or VFT_VXD. For a list of file subtype values, see the Comments section.

block-statement

Specifies one or more version-information blocks. A block can contain string information or variable information.

Comments

To use the constants specified with the VERSIONINFO statement, the WINVER.H file (included in WINDOWS.H) must be included in the resource-definition file.
The following list describes the parameters used in the VERSIONINFO statement:

Parameter

fileflags

Specifies a combination of the following values:

VS_FF_DEBUG

File contains debugging information or is compiled with debugging features enabled.

VS_FF_INFOINFERRED

File contains a dynamically created version-information resource. Some of the blocks for the resource may be empty or incorrect. This value is not intended to be used in version-information resources created by using the VERSIONINFO statement.

VS_FF_PATCHED

File has been modified and is not identical to the original shipping file of the same version number.

VS_FF_PRERELEASE

File is a development version, not a commercially released product.

VS_FF_PRIVATEBUILD

File was not built using standard release procedures. If this value is given, the StringFileInfo block must contain a PrivateBuild string.

VS_FF_SPECIALBUILD

File was built by the original company using standard release procedures but is a variation of the standard file of the same version number. If this value is given, the StringFileInfo block must contain a SpecialBuild string.

fileos

Specifies one of the following values:

Value   Description
VOS_UNKNOWN Operating system for which the file was designed is unknown to Windows.
VOS_DOS File was designed for MS-DOS.
VOS_NT  File was designed for Windows NT.
VOS_WINDOWS16   File was designed for Windows version 3.0 or later.
VOS_WINDOWS32   File was designed for 32-bit Windows.
VOS_DOS_WINDOWS16   File was designed for Windows version 3.0 or later running with MS-DOS.
VOS_DOS_WINDOWS32   File was designed for 32-bit Windows running with MS-DOS.
VOS_NT_WINDOWS32    File was designed for 32-bit Windows running with Windows NT.

The values 0x00002L, 0x00003L, 0x20000L and 0x30000L are reserved.

filetype

Specifies one of the following values:

Value   Description
VFT_UNKNOWN File type is unknown to Windows.
VFT_APP File contains an application.
VFT_DLL File contains a dynamic-link library (DLL).
VFT_DRV File contains a device driver. If the dwFileType member is VFT_DRV, the dwFileSubtype member contains a more specific description of the driver.
VFT_FONT    File contains a font. If the dwFileType member is VFT_FONT, the dwFileSubtype member contains a more specific description of the font.
VFT_VXD File contains a virtual device.
VFT_STATIC_LIB  File contains a static-link library.

All other values are reserved for use by Microsoft.

subtype

Specifies additional information about the file type.
If the FILETYPE statement specifies VFT_DRV, this parameter can be one of the following values:

Value   Description
VFT2_UNKNOWN        Driver type is unknown to Windows.
VFT2_DRV_COMM       File contains a communications driver.
VFT2_DRV_PRINTER    File contains a printer driver.
VFT2_DRV_KEYBOARD   File contains a keyboard driver.
VFT2_DRV_LANGUAGE   File contains a language driver.
VFT2_DRV_DISPLAY    File contains a display driver.
VFT2_DRV_MOUSE      File contains a mouse driver.
VFT2_DRV_NETWORK    File contains a network driver.
VFT2_DRV_SYSTEM File contains a system driver.
VFT2_DRV_INSTALLABLE    File contains an installable driver.
VFT2_DRV_SOUND  File contains a sound driver.

If the FILETYPE statement specifies VFT_FONT, this parameter can be one of the following values:

Value   Description
VFT2_UNKNOWN    Font type is unknown to Windows.
VFT2_FONT_RASTER    File contains a raster font.
VFT2_FONT_VECTOR    File contains a vector font.
VFT2_FONT_TRUETYPE  File contains a TrueType font.

If the FILETYPE statement specifies VFT_VXD, this parameter must be the virtual-device identifier included in the virtual-device control block.
All subtype values not listed here are reserved for use by Microsoft.

langID

Specifies one of the following language codes:

Code    Language    Code    Language
0x0401  Arabic      0x0417  Rhaeto-Romanic
0x0402  Bulgarian   0x0418  Romanian
0x0403  Catalan     0x0419  Russian
0x0404  Traditional Chinese 0x041A  Croato-Serbian (Latin)
0x0405  Czech       0x041B  Slovak
0x0406  Danish      0x041C  Albanian
0x0407  German      0x041D  Swedish
0x0408  Greek       0x041E  Thai
0x0409  U.S. English    0x041F  Turkish
0x040A  Castilian Spanish   0x0420  Urdu
0x040B  Finnish     0x0421  Bahasa
0x040C  French      0x0804  Simplified Chinese
0x040D  Hebrew      0x0807  Swiss German
0x040E  Hungarian   0x0809  U.K. English
0x040F  Icelandic   0x080A  Mexican Spanish
0x0410  Italian     0x080C  Belgian French
0x0411  Japanese    0x0810  Swiss Italian
0x0412  Korean      0x0813  Belgian Dutch
0x0413  Dutch       0x0814  Norwegian - Nynorsk
0x0414  Norwegian - Bokml   0x0816  Portuguese
0x0415  Polish      0x081A  Serbo-Croatian (Cyrillic)
0x0416  Brazilian Portuguese    0x0C0C  Canadian French
0x0417  Rhaeto-Romanic  0x100C  Swiss French

charsetID

Specifies one of the following character-set identifiers:

Identifier  Character Set
0   7-bit ASCII
932 Windows, Japan (Shift - JIS X-0208)
949 Windows, Korea (Shift - KSC 5601)
950 Windows, Taiwan (GB5)
1200    Unicode
1250    Windows, Latin-2 (Eastern European)
1251    Windows, Cyrillic
1252    Windows, Multilingual
1253    Windows, Greek
1254    Windows, Turkish
1255    Windows, Hebrew
1256    Windows, Arabic

string-name

Specifies one of the following redefined names:

Comments

Specifies additional information that should be displayed for diagnostic purposes.

CompanyName

Specifies the company that produced the file¾for example, "Microsoft Corporation" or "Standard Microsystems Corporation, Inc.". This string is required.

FileDescription

Specifies a file description to be presented to users. This string may be displayed in a list box when the user is choosing files to install¾for example, "Keyboard Driver for AT-Style Keyboards" or "Microsoft Word for Windows". This string is required.

FileVersion

Specifies the version number of the file¾for example, "3.10" or "5.00.RC2". This string is required.

InternalName

Specifies the internal name of the file, if one exists¾for example, a module name if the file is a dynamic-link library. If the file has no internal name, this string should be the original filename, without extension. This string is required.

LegalCopyright

Specifies all copyright notices that apply to the file. This should include the full text of all notices, legal symbols, copyright dates, and so on¾for example, "Copyright© Microsoft Corporation 1990-1992". This string is optional.

LegalTrademarks

Specifies all trademarks and registered trademarks that apply to the file. This should include the full text of all notices, legal symbols, trademark numbers, and so on¾for example, "Windows™ is a trademark of Microsoft® Corporation". This string is optional.

OriginalFilename

Specifies the original name of the file, not including a path. This information enables an application to determine whether a file has been renamed by a user. The format of the name depends on the file system for which the file was created. This string is required.

PrivateBuild

Specifies information about a private version of the file¾for example, "Built by TESTER1 on \TESTBED". This string should be present only if the VS_FF_PRIVATEBUILD flag is set in the dwFileFlags member of the VS_FIXEDFILEINFO structure of the root block.

ProductName

Specifies the name of the product with which the file is distributed¾for example, "Microsoft Windows". This string is required.

ProductVersion

Specifies the version of the product with which the file is distributed¾for example, "3.10" or "5.00.RC2". This string is required.

SpecialBuild

Specifies how this version of the file differs from the standard version¾for example, "Private build for TESTER1 solving mouse problems on M250 and M250E computers". This string should be present only if the VS_FF_SPECIALBUILD flag is set in the dwFileFlags member of the VS_FIXEDFILEINFO structure in the root block.

A string information block has the following form:
BLOCK "StringFileInfo"
BEGIN
    BLOCK "lang-charset"
    BEGIN
        VALUE "string-name", "value"
            . . .
    END
END
Following are the parameters in the StringFileInfo block:

lang-charset

Specifies a language and character-set identifier pair. It is a hexadecimal string consisting of the concatenation of the language and character-set identifiers listed earlier in this section.

string-name

Specifies the name of a value in the block and can be one of the redefined names listed earlier in this section.

value

Specifies, as a character string, the value of the corresponding string name. More than one VALUE statement can be given.

A variable information block has the following form:
BLOCK "VarFileInfo"
BEGIN
    VALUE "Translation",
        langID, charsetID
            . . .
END
Following are the parameters in the variable information block:

langID

Specifies one of the language identifiers listed earlier in this section.

charsetID

Specifies one of the character-set identifiers listed earlier in this section. More than one identifier pair can be given, but each pair must be separated from the preceding pair with a comma.

----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------

Preprocessing Reference

- The syntax and semantics for the RC preprocessor is the same as for the
 preprocessor in a C compiler. Single-line comments begin with two forward
 slashes (//) and run to the end of the line.
 Block comments begin with an opening delimiter (/*) and run to a closing
 delimiter (*/). Comments do not nest.

- You use the #define directive to define symbols for your resource
 identifiers in a header file. You include this header both in the resource
 script and your application source code.
 Similarly, the values for attributes and styles are defined by including
 the C header files for Windows.

- You can also define macros.
 The standard C preprocessing operators (#, ##) can be used in a macro
 definition. For detailed information on preprocessing and defining macros,
 see your C compiler documentation.

Directive   Description
#define   Defines a specified name by assigning it a given value.
#elif     Marks an optional clause of a conditional-compilation block.
#else     Marks the last optional clause of a conditional-compilation block.
#endif    Marks the end of a conditional-compilation block.
#if       Conditionally compiles the script if a specified expression is true.
#ifdef    Conditionally compiles the script if a specified name is defined.
#ifndef   Conditionally compiles the script if a specified name is not defined.
#include  Copies the contents of a file into the resource-definition file.
#undef    Removes the definition of the specified name.

#define
~~~~~~~
 #define name value

 The #define directive assigns the given value to the specified name.
 All subsequent occurrences of the name are replaced by the value.

 - Parameters

 name   Specifies the name to be defined. This value is any combination of
        letters, digits, and punctuation.

 value  Specifies any integer, character string, or line of text.

Example  This example assigns values to the names "NONZERO" and "USERCLASS":

#define     NONZERO     1
#define     USERCLASS   "MyControlClass"
#define     path1       "C:\MASM32\BIN"      // Jmm

See Also    #ifdef, #ifndef, #undef

#elif
~~~~~
#elif constant-expression
The #elif directive marks an optional clause of a conditional-compilation
block defined by a #ifdef, #ifndef, or #if directive.
The directive controls conditional compilation of the resource file by
checking the specified constant expression. If the constant expression is
nonzero, #elif directs the compiler to continue processing statements up to
the next #endif, #else, or #elif directive and then skip to the statement
after #endif. If the constant expression is zero, #elif directs the compiler
to skip to the next #endif, #else, or #elif directive. You can use any number
of #elif directives in a conditional block.

- Parameter  constant-expression

Specifies the expression to be checked. This value is a defined name, an i
nteger constant, or an expression consisting of names, integers, and
arithmetic and relational operators.

Example
In this example, #elif directs the compiler to process the second BITMAP
statement only if the value assigned to the name "Version" is less than 7.
The #elif directive itself is processed only if Version is greater than or
equal to 3.

#if Version < 3
BITMAP 1 errbox.bmp
#elif Version < 7
BITMAP 1 userbox.bmp
#endif

#else
~~~~~~
The #else directive marks an optional clause of a conditional-compilation
block defined by a #ifdef, #ifndef, or #if directive. The #else directive
must be the last directive before the #endif directive.
This directive has no arguments.

Example ..
This example compiles the second BITMAP statement only if the name "DEBUG"
is not defined:

#ifdef DEBUG
    BITMAP 1 errbox.bmp
#else
    BITMAP 1 userbox.bmp
#endif

#endif
~~~~~~
The #endif directive marks the end of a conditional-compilation block defined
by a #ifdef directive.
One #endif is required for each #if, #ifdef, or #ifndef directive.
This directive has no arguments.

#if
~~~~
#if constant-expression
The #if directive controls conditional compilation of the resource file by
checking the specified constant expression. If the constant expression is
nonzero, #if directs the compiler to continue processing statements up to
the next #endif, #else, or #elif directive and then skip to the statement
after the #endif directive. If the constant expression is zero, #if directs
the compiler to skip to the next #endif, #else, or #elif directive.

Parameter  constant-expression

Specifies the expression to be checked. This value is a defined name, an
integer constant, or an expression consisting of names, integers, and
arithmetic and relational operators.

Example
This example compiles the BITMAP statement only if the value assigned to the
name "Version" is less than 3:

#if Version < 3
BITMAP 1 errbox.bmp
#endif

#ifdef
~~~~~~~~
#ifdef name

The #ifdef directive controls conditional compilation of the resource file
by checking the specified name. If the name has been defined by using a
#define directive or by using the -d command-line option with the Resource
Compiler, #ifdef directs the compiler to continue with the statement
immediately after the #ifdef directive. If the name has not been defined,
#ifdef directs the compiler to skip all statements up to the next #endif directive.

- Parameter
  name     Specifies the name to be checked by the directive.

- Example
This example compiles the BITMAP statement only if the name "Debug" is defined:

#ifdef Debug
BITMAP 1 errbox.bmp
#endif

#ifndef
~~~~~~~~
#ifndef name

The #ifndef directive controls conditional compilation of the resource file
by checking the specified name. If the name has not been defined or if its
definition has been removed by using the #undef directive, #ifndef directs
the compiler to continue processing statements up to the next #endif, #else,
or #elif directive and then skip to the statement after the #endif directive.
If the name is defined, #ifndef directs the compiler to skip to the next
#endif, #else, or #elif directive.

-Parameter
 name      Specifies the name to be checked by the directive.

- Example
This example compiles the BITMAP statement only if the name "Optimize" is
not defined:

#ifndef Optimize
BITMAP 1 errbox.bmp
#endif

#include
~~~~~~~~
#include (filename)

The #include directive causes Resource Compiler to process the file specified
in the filename parameter. This file should be a header file that defines the
constants used in the resource-definition file.

- Parameter
  filename  Specifies the name of the file to be included.
  If the file is in the current directory, the string must be enclosed in
  double quotation marks; if the file is in the directory specified by the
  INCLUDE environment variable, the string must be enclosed in less-than and
  greater-than characters (<>). You must give a full path enclosed in double
  quotation marks if the file is not in the current directory or in the
  directory specified by the INCLUDE environment variable.

- Example
  This example processes the header files WINDOWS.H and HEADERS\MYDEFS.H
  while compiling the resource-definition file:

  #include
  #include "headers\mydefs.h"

#undef
~~~~~~
#undef name
The #undef directive removes the current definition of the specified name.
All subsequent occurrences of the name are processed without replacement.

- Parameter
  name     Specifies the name to be removed.
  This value is any combination of letters, digits, and punctuation.

- Example
This example removes the definitions for the names "nonzero" and "USERCLASS":

  #undef     nonzero
  #undef     USERCLASS

RC Diagnostic Messages
~~~~~~~~~~~~~~~~~~~~~~
The Help topics available under the alphabetic buttons at the top of the Help
 window contain descriptions of diagnostic messages produced by Microsoft
 Resource Compiler (RC) for Windows NT. Many of these messages appear when
 RC is not able to compile resources properly. The descriptions clarify the
 cause of each message.
A capital V in parentheses (V) at the beginning of a message description
 indicates that the message is displayed only  if RC is run with the /V
 (verbose) option.  These messages are generally  informative and do not
 necessarily indicate errors.

RC Diagnostic Messages          - A -

Accelerator Type required (ASCII or VIRTKEY)

The type parameter in the ACCELERATORS statement must contain either the
ASCII or VIRTKEY value.

RC Diagnostic Messages         - B -

BEGIN expected in Accelerator Table

An ACCELERATORS statement was not followed by the BEGIN keyword.

BEGIN expected in Dialog

A DIALOG statement was not followed by the BEGIN keyword.

BEGIN expected in menu

A MENU statement was not followed by the BEGIN keyword.

BEGIN expected in RCData

An RCDATA statement was not followed by the BEGIN keyword.

BEGIN expected in String Table

A STRINGTABLE statement was not followed by the BEGIN keyword.

BEGIN expected in VERSIONINFO resource

A VERSIONINFO statement was not followed by the BEGIN keyword.

Bitmap file resource-file is not in version-number format.

Use Microsoft Image Editor (IMAGEDIT.EXE) to convert old resource files to the current format.

RC Diagnostic Messages         - C -

Cannot Re-use String Constants

You are using the same value twice in a STRINGTABLE statement. Make sure that you have not mixed overlapping decimal and hexadecimal values.

Control Character out of range [A - Z]

A control character in the ACCELERATORS statement is invalid. The character following the caret (^) must be in the range A through Z.

Could not open in-file-name

Microsoft Windows Resource Compiler (RC) could not open the specified file. Make sure that the file exists and that you typed the filename correctly.

Couldn't open resource-name

Microsoft Windows Resource Compiler (RC) could not open the specified file. Make sure that the file exists and that you typed the filename correctly.

Creating resource-name

(V) Microsoft Windows Resource Compiler (RC) is creating a new binary resource (.RES) file.

RC Diagnostic Messages         - E -

Empty menus not allowed

An END keyword appears before any menu items are defined in the MENU statement. Empty menus are not permitted by Microsoft Windows Resource Compiler (RC). Make sure that you do not have any opening quotation marks within the MENU statement.

END expected in Dialog

The END keyword must appear at the end of a DIALOG statement. Make sure that there are no opening quotation marks left from the preceding statement.

END expected in menu

The END keyword must appear at the end of a MENU statement. Make sure that there are no mismatched BEGIN and END statements.

Error Creating resource-name

Microsoft Windows Resource Compiler (RC) could not create the specified binary resource (.RES) file. Make sure that it is not being created on a read-only drive. Use the -V option to find out whether the file is being created.

Expected Comma in Accelerator Table

Microsoft Windows Resource Compiler (RC) requires a comma between the event and idvalue parameters in the ACCELERATORS statement.

Expected control class name

The class parameter of a CONTROL statement in the DIALOG statement must be one of the following control types: BUTTON, COMBOBOX, EDIT, LISTBOX, SCROLLBAR, STATIC, or user-defined. Make sure that the class is spelled correctly.

Expected font face name

The typeface parameter of the FONT statement in the DIALOG statement must be a character string enclosed in double quotation marks. This parameter specifies the name of a font.

Expected ID value for Menuitem

The MENU statement must contain a MENUITEM statement, which has either an integer or a symbolic constant in the MenuID parameter.

Expected Menu String

Each MENUITEM and POPUP statement must contain a text parameter. This parameter is a string enclosed in double quotation marks that specifies the name of the menu item or pop-up menu. A MENUITEM SEPARATOR statement requires no quoted string.

Expected numeric command value

Microsoft Windows Resource Compiler (RC) was expecting a numeric idvalue parameter in the ACCELERATORS statement. Make sure that you have used a #define constant to specify the value and that the constant used is spelled correctly.

Expected numeric constant in string table

A numeric constant, defined in a #define statement, must immediately follow the BEGIN keyword in a STRINGTABLE statement.

Expected numeric point size

The pointsize parameter of the FONT statement in the DIALOG statement must be an integer point-size value.

Expected Numerical Dialog constant

A DIALOG statement requires integer values for the x, y, width, and height parameters. Make sure that these values, which are included after the DIALOG keyword, are not negative.

Expected String in STRINGTABLE

A string is expected after each numeric stringid parameter in a STRINGTABLE statement.

Expected String or Constant Accelerator command

Microsoft Windows Resource Compiler (RC) was not able to determine which key was being set up for the accelerator. The event parameter in the ACCELERATORS statement might be invalid.

Expected VALUE, BLOCK, or END keyword.

The VERSIONINFO structure requires a VALUE, BLOCK, or END keyword.

Expecting number for ID

A number is expected for the id parameter of a CONTROL statement in the DIALOG statement. Make sure that you have a number or a #define statement for the control identifier.

Expecting quoted string for key

The key string following the BLOCK or VALUE keyword should be enclosed in double quotation marks.

Expecting quoted string in dialog class

The class parameter of the CLASS statement in the DIALOG statement must be an integer or a string enclosed in double quotation marks.

Expecting quoted string in dialog title

The captiontext parameter of the CAPTION statement in the DIALOG statement must be a character string, enclosed in double quotation marks.

RC Diagnostic Messages         - F -

File not found: filename

The file specified in the rc command was not found. Make sure that the file has not been moved to another directory and that the filename or path is typed correctly.

Font names must be ordinals

The pointsize parameter in the FONT statement must be an integer, not a string.

RC Diagnostic Messages         - I -

Invalid Accelerator

An event parameter in the ACCELERATORS statement was not recognized or was more than two characters long.

Invalid Accelerator Type (ASCII or VIRTKEY)

The type parameter in the ACCELERATORS statement must contain either the ASCII or VIRTKEY value.

Invalid control character

A control character in the ACCELERATORS statement is invalid. A valid control character consists of a caret (^) followed by a single letter.

Invalid Control type

The CONTROL statement in a DIALOG statement must be one of the following:  AUTO3STATE, AUTOCHECKBOX, AUTORADIOBUTTON, CHECKBOX, COMBOBOX, CONTROL, CTEXT, DEFPUSHBUTTON, EDITTEXT, GROUPBOX, ICON, LISTBOX, LTEXT, PUSHBOX, PUSHBUTTON, RADIOBUTTON, RTEXT, SCROLLBAR, STATE3.

Invalid directive in preprocessed RC file

The specified filename has an embedded newline character.

Invalid .EXE file

The executable (.EXE) file is invalid. Make sure that the linker created it correctly and that the file exists.

Invalid switch, option

An option used was invalid. For a list of the command-line options, use the RC /? command.

Invalid switch, too many -D switches

Too many /D options were specified. To define a large number of symbols, use the #include directive to include a file of definitions.

Invalid type

The resource type was not among the types defined in the include file.

Invalid usage. Use RC -? for Help

Make sure that you have at least one filename to work with. For a list of the command-line options, use the RC /? command.

I/O error reading file.

Read failed. Since this is a generic routine, no specific filename is supplied.

I/O error seeking in file

Seeking in file failed. Since this is a generic routine, no specific filename is supplied.

I/O error writing file.

Write failed. Since this is a generic routine, no specific filename is supplied.

RC Diagnostic Messages         - N -

No resource binary filename specified.

The /FO option was used, but no binary resource (.RES) file was specified.

RC Diagnostic Messages         - O -

Old DIB in resource-name. Pass it through IMAGEDIT.

The resource file specified is not compatible with Win32. Make sure you have read and saved this file using the latest version of Microsoft Image Editor (IMAGEDIT.EXE).

Out of heap memory

There was not enough memory.

Out of memory, needed n bytes

Microsoft Windows Resource Compiler (RC) was not able to allocate the specified amount of memory.

RC Diagnostic Messages         - R -

Redefinition of Button Type

The specified button styles conflict with or modify the style specified by the control keyword. This is a warning only and may be ignored.
The following common method of declaring an automatic radio button generates this warning:

RADIOBUTTON "&Italic", MYRB_ITALIC, 10, 10, 30, 12, BS_AUTORADIOBUTTON

To avoid the warning, use the control statement appropriate for the type of button that you want to define. In this example, the corrected statement is:

AUTORADIOBUTTON "&Italic", MYRB_ITALIC, 10, 10, 30, 12

RC: Invalid switch: option

An option used was invalid. For a list of the command-line options, use the RC /? command.

RC terminated by user

A CTRL+C key combination was pressed, exiting Microsoft Windows Resource Compiler (RC).

RC terminating after preprocessor errors

For information about preprocessor errors, see the documentation for the preprocessor.

Resource file resource-name is not in version-number format.

Make sure your icons and cursors have been read and saved using the latest version of Microsoft Image Editor (IMAGEDIT.EXE).

RC Diagnostic Messages         - T -

Text string or ordinal expected in Control

The text parameter of a CONTROL statement in the DIALOG statement must be either a text string or an ordinal reference to the type of control that is expected. If using an ordinal, make sure that you have a #define statement for the control.

RC Diagnostic Messages         - U -

Unable to create destination

Microsoft Windows Resource Compiler (RC) was not able to create the destination file. Make sure that there is enough disk space.

Unbalanced Parentheses

Make sure that you have closed every opening parenthesis in the DIALOG statement.

Unexpected value in RCData

The values for the raw-data parameter in the RCDATA statement must be integers or strings, separated by commas. Make sure that you did not leave out a comma or a quotation mark around a string.

Unexpected value in value data

A statement contained information with a format or size different from the expected value for that parameter.

Unknown DIB header format

The device-independent bitmap (DIB) header is not a BITMAPCOREHEADER or BITMAPINFOHEADER structure.

Unknown Menu SubType

The item-definitions parameter of the MENU statement can contain only MENUITEM and POPUP statements.

Unrecognized VERSIONINFO field; BEGIN or comma expected

The format of the information following a VERSIONINFO statement is incorrect.

RC Diagnostic Messages         - V -

Version WORDs separated by commas expected

Values in an information block for a VERSIONINFO statement should be separated by commas.

RC Diagnostic Messages         - W -

Warning: ASCII character not equivalent to virtual key code

An invalid virtual-key code exists in the ACCELERATORS statement. The ASCII values for some characters such as *, ^, or & are not equivalent to the virtual-key codes for the corresponding keys. In the case of the asterisk [*], the virtual-key code is equivalent to the ASCII value for 8, the numeric character on the same key. Therefore, the statement VIRTKEY '* ' is invalid.

Warning: SHIFT or CONTROL used without VIRTKEY

The ALT, SHIFT, and CONTROL options apply only to virtual keys in the ACCELERATORS statement. Make sure that the VIRTKEY option is used with one of these other options.

Writing resource type image lang:language size:size

(V) Microsoft Windows Resource Compiler (RC) is writing the specified resource. The type is the resource type. It may be a number or a string. The image can be a number or a string. The language is the national language of the resource. The size is the decimal size of the resource in bytes.


Sommaire Introduction

   ------------------------------ Sommaire -----------------------------

Resource Compiler for Windows NT
Microsoft Windows Resource Compiler (RC) is a tool for the Microsoft Windows
NT operating system.
This document describes how to create a resource-definition (script) file,
and how to compile your application's resources and add them to the
application's executable file.

                    -*-  Contents  -*-

        -   Including Resources in an Application
        -   Creating a Resource-Definition File
        -       Preprocessing Directives
        -       Single-Line Statements
        -       Multiline Statements
        -       Sample Resource-Definition File
        -   Using RC (The RC Command Line)
        -       Defining Names for the Preprocessor
        -       Renaming the Compiled Resource File
        -       Searching for Files
        -       Displaying Progress Messages
        -   Resource-Definition Statements        395
        -       Common Statement Parameters       457
        -       Common Resource Attributes        564
            Preprocessing Reference               3253
            RC Diagnostic Messages

 --------------------------------------------------------------------------
 ---            Sommaire de Resource-Definition Statements              ---

                                              ICON Resource
    Common Statement Parameters               ICON Resource
    Common Resource Attributes                ICON Control
    ACCELERATORS Resource                     LANGUAGE Statement
    AUTO3STATE Control                        LTEXT Control
    AUTOCHECKBOX Control                      MENU Resource
    AUTORADIOBUTTON Control                   MENU Statement
    BITMAP Resource                           MENUEX Statement
    CAPTION Statement                         MENUITEM Statement
    CHARACTERISTICS Statement                 MESSAGETABLE Resource
    CHECKBOX Control                          POPUP Resource
    CLASS Statement                           PUSHBOX Control
    COMBOBOX Control                          PUSHBUTTON Control
  - CONTROL: General Control                  RADIOBUTTON Control
    CTEXT Control                             RCDATA Resource
    CURSOR Resource                           RTEXT Control
    DEFPUSHBUTTON Control                     SCROLLBAR Control
    DIALOG Resource                           STATE3 Control
    DIALOGEX Resource                         STRINGTABLE Resource
    EDITTEXT Control                        - STYLE Statement        2691
    EXSTYLE Statement                         User-Defined Resource
    FONT Resource                             VERSION Statement
    FONT Statement                            VERSIONINFO Resource
    GROUPBOX Control

----------------------------------------------------------------------------

               Including Resources in an Application
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To include resources in your 32-bit Windows application, do the following:

 1. Create individual resource files for cursors, icons, bitmaps, dialog
    boxes, and fonts. To do this, you can use Microsoft Image Editor and
    Dialog Editor (IMAGEDIT.EXE and DLGEDIT.EXE) and Microsoft Windows
    Font Editor (FONTEDIT.EXE).
 2. Create a resource-definition file (script) that describes all the
    resources used by the application.
 3. Compile the script into a resource (.RES) file with RC.
 4. Link the compiled resource files into the application's executable file.

Unlike for the 16-bit versions of the Windows development system, you do not
use RC to include compiled resources into the executable file or to mark the
file as a Windows application. The linker recognizes the compiled resource
files and links them to the executable file.


Creating a Resource-Definition File

After creating individual resource files for your application's icon, cursor,
font, bitmap, and dialog-box resources,you create a resource-definition file,
or script. A script file is a text file with the extension .RC.
The script lists every resource in your application and describes some types
of resources in great detail. For a resource that exists in a separate file,
such as an icon or cursor, the script names the resource and the file that
contains it. For some resources, such as a menu, the entire definition of
the resource exists within the script .
A cript file can contain the following types of information:

· Preprocessing directives, which instruct RC to perform actions on the script
  before compiling it. Directives can also assign values to names.
· Statements, which name and describe resources.

The following sections describe directives and statements you can use in a
script. For detailed descriptions and syntax for each statement,
see "Resource-Definition Statements".

Preprocessing Directives
~~~~~~~~~~~~~~~~~~~~~~~~

The following directives can be used as needed in the script to instruct
RC to perform actions or to assign values to names:

Directive   Description

#define  Defines a specified name by assigning it a given value.
#elif    Marks an optional clause of a conditional-compilation block.
#else    Marks the last optional clause of a conditional-compilation block.
#endif   Marks the end of a conditional-compilation block.
#if      Conditionally compiles the script if a specified expression is true.
#ifdef   Conditionally compiles the script if a specified name is defined.
#ifndef  Conditionally compiles the script if a specified name is not defined.
#include Copies the contents of a file into the resource-definition file.
#undef   Removes the definition of the specified name.

 The syntax and semantics for the RC preprocessor is the same as for a
     C compiler. For more information on preprocessing in RC
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            see "Preprocessing Reference".

Single-Line Statements
~~~~~~~~~~~~~~~~~~~~~~

A single-line statement can begin with any of the following keywords:

Keyword Description

BITMAP  Defines a bitmap by naming it and specifying the name of the file
        that contains it. (To use a particular bitmap, the application
        requests it by name.)
CURSOR  Defines a cursor by naming it and specifying the name of the file
        that contains it. (To use a particular cursor, the application
        requests it by name.)
FONT    Specifies the name of a file that contains a font.
ICON    Defines an icon by naming it and specifying the name of the file that
        contains it.(To use a particular icon, the application requests it by name.)
LANGUAGE    Sets the language for all resources up to the next LANGUAGE
        statement or to the end of the file. When the LANGUAGE statement
        appears before the BEGIN in an ACCELERATORS, DIALOG, MENU, RCDATA,
        or STRINGTABLE resource definition, the specified  applies
        only to that resource.
MESSAGETABLE    Defines a message table by naming it and specifying the name
        of the file that contains it. The file is a binary resource file
        generated by the Message Compiler.

Multiline Statements
~~~~~~~~~~~~~~~~~~~~
A multiline statement can begin with any of the following keywords:

Keyword Description

ACCELERATORS    Defines menu accelerator keys.
DIALOG          Defines a template that an application can use to create
                dialog boxes.
MENU            Defines the appearance and function of a menu.
RCDATA          Defines data resources. Data resources let you include binary
                data in the executable file.
STRINGTABLE     Defines string resources. String resources are Unicode strings
                that can be loaded from the executable file.

Each of these multiline statements allows optional statements before the
BEGIN ... END block that defines the resource. You can specify zero or more
of the following statements:

Statement   Decription
CHARACTERISTICS dword   User-defined information about the resource that can
be used by tools that read and write resource files. The value appears in
the compiled resource file. However, it is not stored in the executable file
and is not used by Windows.
LANGUAGE language, sublanguage  Specifies the language for the resource.
The parameters are constants from WINNLS.H.
VERSION dword   User-defined version number for the resource that can be
used by tools that read and write resource files. The value appears in the
compiled resource file. However, it is not stored in the executable file and
is not used by Windows.

Sample Resource-Definition File
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The following example shows a script file that defines the resources for an
application named Shapes:

#include "SHAPES.H"

ShapesCursor  CURSOR  SHAPES.CUR
ShapesIcon    ICON    SHAPES.ICO

ShapesMenu    MENU
    BEGIN
        POPUP "&Shape"
            BEGIN
                MENUITEM "&Clear", ID_CLEAR
                MENUITEM "&Rectangle", ID_RECT
                MENUITEM "&Triangle", ID_TRIANGLE
                MENUITEM "&Star", ID_STAR
                MENUITEM "&Ellipse", ID_ELLIPSE
            END
    END

The CURSOR statement names the application's cursor resource ShapesCursor and
specifies the cursor file SHAPES.CUR,which contains the image for that cursor.
The ICON statement names the application's icon resource ShapesIcon and
specifies the icon file SHAPES.ICO, which contains the image for that icon.
The MENU statement defines an application menu named ShapesMenu, a pop-up
menu with five menu items.
The menu definition, enclosed by the BEGIN and END keywords, specifies each
menu item and the menu identifier that is returned when the user selects that
item. For example, the first item on the menu, Clear, returns the menu
identifier ID_CLEAR when the user selects it.
The menu identifiers are defined in the application header file, SHAPES.H.


Using RC (The RC Command Line)

To start RC, use the RC command.
The following line shows RC command-line syntax:

                       RC [options] script-file

The RC command's options parameter can include one or more of the following
 options:

/?  Displays a list of RC command-line options.

/d  Defines a symbol for the preprocessor that you can test with the #ifdef
    directive.

/foresname   Uses resname for the name of the .RES file.

/h  Displays a list of RC command-line options.

/i  Searches the specified directory before searching the directories specified
    by the INCLUDE environment variable.

/lcodepage  Specifies default language for compilation.  For example,
            -l409 is equivalent to including the following statement at the
            top of the resource script file:

                  LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US

/r  Ignored. Provided for compatibility with existing makefiles.

/v  Displays messages that report on the progress of the compiler.

/x  Prevents RC from checking the INCLUDE environment variable when
    searching for header files or resource files.

 Options are not case-sensitive, and a hyphen (-) can be used in place of a
 slash mark (/). You can combine single-letter options if they do not require
 any additional parameters. For example, the following two commands are
 equivalent:
                RC /V /X SAMPLE.RC    <=>    rc -vz sample.rc

 The script-file parameter specifies the name of the resource-definition
 file that contains the names, types, filenames, and descriptions of the
 resources to be compiled.

Defining Names for the Preprocessor
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can specify conditional compilation in a script, based on whether a name
is defined on the RC command line with the /d option, or in the file or an
include file with the #define directive.
For example, suppose your application has a pop-up menu, the Debug menu,that
should appear only with debugging versions of the application.
When you compile the application for normal use, the Debug menu is not
included. The following example shows the statements that can be added to
the resource-definition file to define the Debug menu:

MainMenu MENU
BEGIN
  . . .
#ifdef DEBUG
        POPUP "&Debug"
        BEGIN
                MENUITEM "&Memory usage", ID_MEMORY
                MENUITEM "&Walk data heap", ID_WALK_HEAP
        END
#endif
END

When compiling resources for a debugging version of the application,
you could include the Debug menu by using the following RC command:

   rc -d DEBUG myapp.rc

To compile resources for a normal version of the application¾one that does
not include the Debug menu you could use the following RC command:

   rc myapp.rc

Renaming the Compiled Resource File
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

By default, when compiling resources, RC names the compiled resource (.RES)
file with the base name of the .RC file and places it in the same directory
as the .RC file. CVTRES must then be invoked to convert the .RES file to a
binary resource format which can be understood by the linker (.RBJ).
The following example compiles MYAPP.RC and creates a compiled resource file
named MYAPP.RES in the same directory as MYAPP.RC:

   rc myapp.rc

The /fo option lets you give the resulting .RES file a name that differs from
the name of the corresponding .RC file. For example, to name the resulting
.RES file NEWFILE.RES, you would use the following command:

   rc -fo newfile.res myapp.rc

The /fo option can also place the .RES file in a different directory.
For example, the following command places the compiled resource file
MYAPP.RES in the directory C:\SOURCE\RESOURCE:

   rc -fo c:\source\resource\myapp.res myapp.rc

Searching for Files
~~~~~~~~~~~~~~~~~~~~

By default, RC searches for header files and resource files (such as icon and
cursor files) first in the current directory and then in the directories
specified by the INCLUDE environment variable. (The PATH environment variable
has no effect on which directories RC searches.)

Adding a Directory to Search

You can use the /i option to add a directory to the list of directories RC
searches. The compiler then searches the directories in the following order:

 1. The current directory
 2. The directory or directories you specify by using the /i option,
    in the order in which they appear on the RC command line
 3. The list of directories specified by the INCLUDE environment variable,in
 the order in which the variable lists them,unless you specify the /x option

The following example compiles the resource-definition file MYAPP.RC:

         rc /i c:\source\stuff /i d:\resources myapp.rc

When compiling the script MYAPP.RC, RC searches for header files and resource
files first in the current directory, then in C:\SOURCE\STUFF and
D:\RESOURCES, and then in the directories  specified by the INCLUDE
environment variable.

Suppressing the INCLUDE Environment Variable

You can prevent RC from using the INCLUDE environment variable when determining
the directories to search. To do so, use the /x option.
The compiler then searches for files only in the current directory and in any
directories you specify by using the /i option.
The following example compiles the script file MYAPP.RC:

             rc /x /i c:\source\stuff myapp.rc

When compiling the script MYAPP.RC, RC searches for header files and resource
files first in the current directory and then in C:\SOURCE\STUFF. It does not
search the directories specified by the INCLUDE environment variable.

Displaying Progress Messages
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
By default, RC compiles quietly. It does not display messages that report on
its progress. You can, however, specify that RC is to display these messages.
To do so, use the /v option.
The following example causes RC to report on its progress as it compiles the
resource-definition file SAMPLE.RC and creates the compiled resource file
SAMPLE.RES:
             rc /v sample.rc


Resource-Definition Statements

This section describes the statements that define the resources that the
Resource Compiler puts in the resource (.RES) file.
Once a resource is linked to the executable file, the application can load
the resource as it is needed at run time.
All resource statements associate an identifying name or number with a given
resource.

Common Statement Parameters              *** TITRE  de recherche ***
Common Resource Attributes
ACCELERATORS Resource
AUTO3STATE Control
AUTOCHECKBOX Control
AUTORADIOBUTTON Control
BITMAP Resource
CAPTION Statement
CHARACTERISTICS Statement
CHECKBOX Control
CLASS Statement
COMBOBOX Control
CONTROL: General Control
CTEXT Control
CURSOR Resource
DEFPUSHBUTTON Control
DIALOG Resource
DIALOGEX Resource
EDITTEXT Control
EXSTYLE Statement
FONT Resource
FONT Statement
GROUPBOX Control
ICON Resource
ICON Control
LANGUAGE Statement

LISTBOX Control
LTEXT Control
MENU Resource
MENU Statement
MENUEX Statement
MENUITEM Statement
MESSAGETABLE Resource
POPUP Resource
PUSHBOX Control
PUSHBUTTON Control
RADIOBUTTON Control
RCDATA
RTEXT Control
SCROLLBAR Control
STATE3 Control
STRINGTABLE Resource
STYLE Statement
User-Defined Resource
VERSION Statement
VERSIONINFO Resource


Common Statement Parameters

- This section lists parameters in common among the resource or control
  statements.Occasionally,a certain statement will use a parameter
  differently, or may ignore a parameter.
  The statement-specific variation is described with the statement in the
  alphabetical reference.

Common Control Parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~
  The general syntax for a control definition, and the meaning of each
  parameter is as follows:

   control [text,] id, x, y, width, height [, style [, extended-style]]

  Horizontal dialog units are 1/4 of the dialog base width unit.
  Vertical units are 1/8 of the dialog base height unit.
  The current dialog base units are computed from the height and width of
  the current system font.
  The GetDialogBaseUnits function returns the dialog base units in pixels.
  The coordinates are relative to the origin of the dialog box.

                          -  Parameters  -
  control

- Keyword that indicates the type of control being defined,
  such as PUSHBUTTON or CHECKBOX.

  text

- Specifies text that is displayed with the control. The text is positioned
  within the control's specified dimensions, or adjacent to the control.
- This parameter must contain zero or more characters enclosed in double
  quotation marks.  Strings are automatically null-terminated and converted
  to Unicode in the resulting resource file, except for strings specified in
  raw-data statements. (raw-data can be specified in RCDATA and user-defined
  resources.) To specify a Unicode string in raw-data, explicitly qualify
  the string as a wide-character string by using the L prefix.
- By default, the characters listed between the double quotation marks are
  ANSI characters and escape sequences are interpreted as byte escape
  sequences. If the string is preceded by the L prefix, the string is a
  wide-character string and escape sequences are interpreted as two-byte
  escape sequences that specify Unicode characters. If a double quotation
  mark is required in the text, you must include the double quotation mark
  twice or use the \" escape sequence.
- An ampersand (&) character in the text indicates that the following
  character is used as a mnemonic character for the control. When the control
  is displayed, the ampersand is not shown, but the mnemonic character is
  underlined.The user can choose the control by pressing the key
  corresponding  to the underlined mnemonic character.
  To use the ampersand as a character in a string, insert two ampersands (&&).

  id

- Specifies the control identifier. This value must be a 16-bit unsigned
  integer in the range 0 through 65,535 or a simple arithmetic expression
  that evaluates to a value in that range.

  x

- Specifies the x-coordinate of the left side of the control relative to the
  left side of the dialog box.
  This value must be a 16-bit unsigned integer in the range 0 through 65,535.
  The coordinate is in dialog units and is relative to the origin of the
  dialog box, window, or control containing the specified control.

  y

- Specifies the y-coordinate of the top side of the control relative to the
  top of the dialog box.
  This value must be a 16-bit unsigned integer in the range 0 through 65,535.
  The coordinate is in dialog units relative to the origin of the dialog box, window, or control containing the specified
  control.

  width

- Specifies the width of the control.
  This value must be a 16-bit unsigned integer in the range 1 through 65,535.
  The width is in 1/4-character units.

  height

- Specifies the height of the control.
  This value must be a 16-bit unsigned integer in the range 1 through 65,535.
  The height is in 1/8-character units.

  style

- Specifies the control styles.
  Use the bitwise OR (|) operator to combine styles.

  extended-style

- Specifies extended (WS_EX_xxx) styles.
  You must specify a style to specify an extended-style.
  See also EXSTYLE.


Common Resource Attributes

All resource-definition statements include a load-mem option that specifies
the loading and memory characteristics of the resource.
These attributes are divided into two groups:
load attributes and memory attributes.
- The only attribute that is used by Win32 is the DISCARDABLE attribute.
- The remaining attribute specifiers are allowed in the script for
  compatibility with existing scripts, but are ignored.

-*- Load Attributes
The load attributes specify when the resource is to be loaded.
The load parameter must be one of the following:

  PRELOAD
Ignored. In 16-bit Windows, the resource is loaded with the executable file.

  LOADONCALL
Ignored. In 16-bit Windows, the resource is loaded when called.

-*- Memory Attributes
The memory attributes specify whether the resource is fixed or movable,
whether it is discardable, and whether it is pure. The memory parameter
can be one or more of the following:

  FIXED
Ignored. In 16-bit Windows, the resource remains at a fixed memory location.

  MOVEABLE    = mobile
Ignored. In 16-bit Windows, the resource can be moved if necessary in order
to compact memory.

  DISCARDABLE = Jeter
Resource can be discarded if no longer needed.

  PURE
Ignored. Accepted for compatibility with existing resource scripts.

 IMPURE
Ignored. Accepted for compatibility with existing resource scripts.

The default is DISCARDABLE for cursor, icon, and font resources.

      *************************************************************

ACCELERATORS Resource        stroke = trait course caresse ...

acctablename ACCELERATORS
[optional-statements]
BEGIN
    event, idvalue, [type] [options]
    . . .
END
The ACCELERATORS statement defines one or more accelerators for an application.
An accelerator is a keystroke defined by the application to give the user a
quick way to perform a task. The TranslateAccelerator function is used to
translate accelerator messages from the application queue into WM_COMMAND or
WM_SYSCOMMAND messages.

 Parameters

acctablename

Specifies either a unique name or a 16-bit unsigned integer value that
identifies the resource.

optional-statements

Zero or more of the following statements:

Statement   Decription
CHARACTERISTICS dword User-defined information about a resource that can be
used by tools that read and write resource files.
LANGUAGE language, sublanguage  Specifies the language for the resource.
The parameters are constants from WINNLS.H.
VERSION dword   User-defined version number for the resource that can be used
by tools that read and write resource files.

event
Specifies the keystroke to be used as an accelerator.
It can be any one of the following character types:

"char"
A single character enclosed in double quotation marks.
The character can be preceded by a caret (^), meaning that the character is
a control character.

Character
An integer value representing a character. The type parameter must be ASCII.

Virtual-key character
An integer value representing a virtual key. The virtual key for alphanumeric
keys can be specified by placing the uppercase letter or number in double
quotation marks (for ex.., "9" or "C"). The type parameter must be VIRTKEY.

idvalue
Specifies a 16-bit unsigned integer value that identifies the accelerator.

type
Required only when the event parameter is a character or a virtual-key character.
The type parameter specifies either ASCII or VIRTKEY; the integer value of
event is interpreted accordingly.

When VIRTKEY is specified and event contains a string, event must be
uppercase.

options
Specifies the options that define the accelerator. This parameter can be one
or more of the following values:

NOINVERT
Specifies that no top-level menu item is highlighted when the accelerator
is used. This is useful when defining accelerators for actions such as
scrolling that do not correspond to a menu item. If NOINVERT is omitted,
a top-level menu item will be highlighted (if possible) when the accelerator
is used.

ALT
Causes the accelerator to be activated only if the ALT key is down.

SHIFT
Causes the accelerator to be activated only if the SHIFT key is down.

CONTROL
Defines the character as a control character (the accelerator is only
activated if the CONTROL key is down). This has the same effect as using a
caret (^) before the accelerator character in the event parameter.

The ALT, SHIFT, and CONTROL options apply only to virtual keys.

Example .. The following example demonstrates the use of accelerator keys:

1 ACCELERATORS
BEGIN
  "^C",  IDDCLEAR                         ; control C
  "K",   IDDCLEAR                         ; shift K
  "k",   IDDELLIPSE, ALT                  ; alt k
  98,    IDDRECT, ASCII                   ; b
  66,    IDDSTAR, ASCII                   ; B (shift b)
  "g",   IDDRECT                          ; g
  "G",   IDDSTAR                          ; G (shift G)
  VK_F1, IDDCLEAR,   VIRTKEY              ; F1
  VK_F1, IDDSTAR,    CONTROL,    VIRTKEY  ; control F1
  VK_F1, IDDELLIPSE, SHIFT  ,    VIRTKEY  ; shift F1
  VK_F1, IDDRECT,    ALT    ,    VIRTKEY  ; alt F1
  VK_F2, IDDCLEAR,   ALT, SHIFT, VIRTKEY  ; alt shift F2
  VK_F2, IDDSTAR, CONTROL, SHIFT,VIRTKEY  ; ctrl shift F2
  VK_F2, IDDRECT,   ALT, CONTROL,VIRTKEY  ; alt control F2
END
  Ne pas oublier de #define les VK_key ave avec leurs valeurs d'origines

AUTO3STATE Control
AUTO3STATE text, id, x, y, width, height [, style [, extended-style]]
The AUTO3STATE statement creates an automatic 3-state check box.
The control is an open box with the given text positioned to the right of
the box. When chosen, the box automatically advances between three states:
checked, unchecked, and disabled (grayed). The control sends a message to
its parent whenever the user chooses the control.

      Parameters

style
Specifies styles for the control, which can be a combination of the
BS_AUTO3STATE style and the following styles: WS_TABSTOP, WS_DISABLED,
and WS_GROUP.
The default style for this control is BS_AUTO3STATE and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and
extended-style parameters, see "
Common Statement Parameters".

See Also   AUTOCHECKBOX, CHECKBOX, CONTROL, STATE3

AUTOCHECKBOX Control

AUTOCHECKBOX text, id, x, y, width, height [, style [, extended-style]]
The AUTOCHECKBOX statement creates an automatic check box control.
The control is a small rectangle (check box) that has the specified text
displayed next to it (typically, to the right). When the user chooses the
control, the control highlights the rectangle and sends a message to its
parent window. The AUTOCHECKBOX statement, which can only be used in the
body of a DIALOG statement, defines the text, identifier, dimensions,
and attributes of the control.

Parameters

style
Specifies the styles of the control. This value can be a combination of the
button class style BS_AUTOCHECKBOX and the WS_TABSTOP and WS_GROUP styles.
If you do not specify a style, the default style is BS_AUTOCHECKBOX and
WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and
extended-style parameters, see "Common Statement Parameters".

See Also   AUTO3STATE, CHECKBOX, CONTROL, STATE3

AUTORADIOBUTTON Control

AUTORADIOBUTTON text, id, x, y, width, height [, style [, extended-style]]
The AUTORADIOBUTTON control statement specifies an automatic radio button control. This control automatically performs mutual exclusion with the other AUTORADIOBUTTON controls in the same group. When the button is chosen, the application is notified with BN_CLICKED

Parameters

text
The specified text appears next to the radio button.

style
Specifies styles for the automatic radio button, which can be a combination
of BUTTON-class styles and the following styles: WS_TABSTOP, WS_DISABLED,
and WS_GROUP.
The default style for AUTORADIOBUTTON is BS_AUTORADIOBUTTON and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and
extended-style parameters, see "Common Statement Parameters".

See Also  CONTROL, RADIOBUTTON

BITMAP Resource

nameID BITMAP [load-mem] filename

The BITMAP resource-definition statement specifies a bitmap that an
application uses in its screen display or as an item in a menu or control.

Parameters

nameID
Specifies either a unique name or a 16-bit unsigned integer value identifying
the resource.

load-mem
Specifies loading and memory attributes for the resource.
For more information, see "Common Resource Attributes".

filename
Specifies the name of the file that contains the resource.
The name must be a valid filename; it must be a full path if the file is
not in the current working directory. The path can either be a quoted or
non-quoted string.

Example .. The following example specifies two bitmap resources:

          disk1   BITMAP disk.bmp
          12      BITMAP PRELOAD diskette.bmp

See Also  LoadBitmap

CAPTION Statement

CAPTION captiontext
The CAPTION statement defines the title for a dialog box. The title appears in the box's caption bar (if it has one).
The default caption is empty.

Parameter

captiontext

Specifies a character string enclosed in double quotation marks.

Example

The following example demonstrates the use of the CAPTION statement:

CAPTION "Error!"

CHARACTERISTICS Statement
~~~~~~~~~~~~~~~~~~~~~~~~~~
CHARACTERISTICS dword
The CHARACTERISTICS statement allows the developer to specify information
about a resource that can be used by tools that read and write
resource-definition files. The specified dword value appears with the
resource in the compiled .RES file. However, the value is not stored in the
executable file and has no significance to Windows.

The CHARACTERISTICS statement appears before the BEGIN in an ACCELERATORS,
DIALOG, MENU, RCDATA, or STRINGTABLE resource definition.The specified value
applies only to that resource.

Parameter  dword

A user-defined doubleword value.

 CHECKBOX Control
 ~~~~~~~~~~~~~~~~
CHECKBOX text, id, x, y, width, height [, style [, extended-style]]
The CHECKBOX statement creates a check box control.
The control is a small rectangle (check box) that has the specified text
displayed next to it (typically, to the right). When the user selects the
control, the control highlights the rectangle and sends a message to its
parent window. The CHECKBOX statement, which can only be used in a DIALOG
statement, defines the text, identifier, dimensions, and attributes of the
control.

Parameters

text
Specifies text that is displayed to the right of the control.

style
Specifies the control styles. This value can be a combination of the button
class style BS_CHECKBOX and the WS_TABSTOP and WS_GROUP styles.If you do not
specify a style, the default style is BS_CHECKBOX and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and
extended-style parameters, see "Common Statement Parameters".

Example

This example creates a check-box control that is labeled "Italic":

CHECKBOX "Italic", 3, 10, 10, 40, 10

See Also AUTOCHECKBOX, AUTO3STATE, STATE3, GetDialogBaseUnits

CLASS Statement
~~~~~~~~~~~~~~~~
CLASS class
The CLASS statement defines the class of the dialog box. The CLASS statement appears in the optional section before a DIALOG statement's BEGIN keyword. If no class is given, the Windows standard dialog class is used.

Parameters

class
Specifies a 16-bit unsigned integer or a string, enclosed in double quotation marks, that identifies the class of the dialog box. If the window procedure for the class does not process a message sent to it, it must call the DefDlgProc function to ensure that all messages are handled properly for the dialog box. A private class can use DefDlgProc as the default window procedure. The class must be registered with the cbWndExtra member of the WNDCLASS structure set to DLGWINDOWEXTRA.

Comments
The CLASS statement should only be used with special cases, since it overrides the normal processing of a dialog box. The CLASS statement converts a dialog box to a window of the specified class; depending on the class, this could give undesirable results. Do not use the redefined control-class names with this statement.

Example
The following example demonstrates the use of the CLASS statement:

CLASS "myclass"

See Also    DIALOG, DefDlgProc

COMBOBOX Control
~~~~~~~~~~~~~~~~

COMBOBOX text, id, x, y, width, height [, style [, extended-style]]
The COMBOBOX statement creates a combination box control (a combo box). A combo box consists of either a static text box or an edit box combined with a list box. The list box can be displayed at all times or pulled down by the user. If the combo box contains a static text box, the text box always displays the selection (if any) in the list box portion of the combo box. If it uses an edit box, the user can type in the desired selection; the list box highlights the first item (if any) that matches what the user has entered in the edit box. The user can then select the item highlighted in the list box to complete the choice. In addition, the combo box can be owner-drawn and of fixed or variable height.

Parameters

style

Specifies the control styles. This value can be a combination of the COMBOBOX class styles and any of the following styles: WS_TABSTOP, WS_GROUP, WS_VSCROLL, and WS_DISABLED.
If you do not specify a style, the default style is CBS_SIMPLE and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "
Common Statement Parameters".

Example

This example creates a combo-box control with a vertical scroll bar:

COMBOBOX 777, 10, 10, 50, 54, CBS_SIMPLE | WS_VSCROLL | WS_TABSTOP

-----------------------------------------------------------------------------

                       CONTROL: General Control
                       ~~~~~~~~~~~~~~~~~~~~~~~~

CONTROL text, id, class, style, x, y, width, height [, extended-style]
This statement defines a user-defined control window.

Parameters

class

Specifies a redefined name, character string, a 16-bit unsigned integer value that defines the class. This can be any one of the control classes; for a list of the control classes, see the first list following this description. If the value is a redefined name supplied by the application, it must be a string enclosed in double quotation marks.

style

Specifies a redefined name or integer value that specifies the style of the given control. The exact meaning of style depends on the class value. the sections following this description show the control classes and corresponding styles.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "
Common Statement Parameters".
The six possible control classes are described in the following sections.

The Button Control Class
~~~~~~~~~~~~~~~~~~~~~~~~

A button control is a small rectangular child window that represents a "button" that the user can turn on or off by clicking it with the mouse. Button controls can be used alone or in groups, and can either be labeled or appear without text. Button controls typically change appearance when the user clicks them.
A button can have only one of the following styles, with the exception of BS_LEFTTEXTBS, which can be combined with check boxes and radio buttons.

BS_3STATE

Creates a button that is the same as a check box, except that the box can be grayed (dimmed) as well as checked. The grayed state is used to show that the state of the check box is not determined.

BS_AUTO3STATE

Creates a button that is the same as a three-state check box, except that the box changes its state when the user selects it. The state cycles through checked, grayed, and normal.

BS_AUTOCHECKBOX

Creates a button that is the same as a check box, except that an X appears in the check box when the user selects the box; the X disappears (is cleared) the next time the user selects the box.

BS_AUTORADIOBUTTON

Creates a button that is the same as a radio button, except that when the user selects it, the button automatically highlights itself and clears (removes the selection from) any other buttons in the same group.

BS_CHECKBOX

Creates a small square that has text displayed to its right (unless this style is combined with the BS_LEFTTEXT style).

BS_DEFPUSHBUTTON

Creates a button that has a heavy black border. The user can select this button by pressing the ENTER key. This style is useful for enabling the user to quickly select the most likely option (the default option).

BS_GROUPBOX

Creates a rectangle in which other controls can be grouped. Any text associated with this style is displayed in the rectangle's upper-left corner.

BS_LEFTTEXT

Places text on the left side of the radio button or check box when combined with a radio button or check box style.

BS_OWNERDRAW

Creates an owner-drawn button. The owner window receives a WM_MEASUREITEM message when the button is created, and it receives a WM_DRAWITEM message when a visual aspect of the button has changed. The BS_OWNERDRAW style cannot be combined with any other button styles.

BS_PUSHBUTTON

Creates a push button that posts a WM_COMMAND message to the owner window when the user selects the button.

BS_RADIOBUTTON

Creates a small circle that has text displayed to its right (unless this style is combined with the BS_LEFTTEXT style). Radio buttons are usually used in groups of related but mutually exclusive choices.

The Combobox Control Class

Combo-box controls consist of a selection field similar to an edit control plus a list box. The list box may be displayed at all times or may be dropped down when the user selects a "pop box" next to the selection field.
Depending on the style of the combo box, the user can or cannot edit the contents of the selection field. If the list box is visible, typing characters into the selection box will cause the first list-box entry that matches the characters typed to be highlighted. Conversely, selecting an item in the list box displays the selected text in the selection field. Combo-box control styles are described below.

CBS_SIMPLE

Displays the list box at all times. The current selection in the list box is displayed in the edit control.

CBS_DROPDOWN

Similar to CBS_SIMPLE except that the list box is not displayed unless the user selects an icon next to the selection field.

CBS_DROPDOWNLIST

Similar to CBS_DROPDOWN except that the edit control is replaced by a static text item which displays the current selection in the list box.

CBS_OWNERDRAWFIXED

Specifies a fixed-height owner-draw combo box. The owner of the list box is responsible for drawing its contents; the items in the list box are all the same height.

CBS_OWNERDRAWVARIABLE

Specifies a variable-height owner-draw combo box. The owner of the list box is responsible for drawing its contents; the items in the list box can have different heights.

CBS_AUTOHSCROLL

Scrolls the text in the edit control to the right when the user types a character at the end of the line. If this style is not set, only text that fits within the rectangular boundary is allowed.

CBS_SORT

Sorts strings entered into the list box.

CBS_HASSTRINGS

Specifies an owner-draw combo box that contains items consisting of strings. The combo box maintains the memory and pointers for the strings so that the application can use the LB_GETTEXT message to retrieve the text for a particular item.

CBS_OEMCONVERT

Converts text entered in the combo box edit control from the ANSI character set to the OEM character set and then back to ANSI. This ensures proper character conversion when the application calls the CharToOem function to convert an ANSI string in the combo box to OEM characters. This style is most useful for combo boxes that contain filenames and applies only to combo boxes created with the CBS_SIMPLE or CBS_DROPDOWN styles.

The Edit Control Class

An edit control is a rectangular child window in which the user can enter text from the keyboard. The user selects the control, and gives it the input focus, by clicking the mouse inside it or pressing the TAB key. The user can enter text when the control displays a flashing insertion point. The mouse can be used to move the cursor and select characters to be replaced, or to position the cursor for inserting characters. The BACKSPACE key can be used to delete characters.
Edit controls use the fixed-pitch font and display Unicode characters. They expand tab characters into as many space characters as are required to move the cursor to the next tab stop. Tab stops are assumed to be at every eighth character position. Edit control styles are described below.

ES_LEFT

Justifies the text to the left.

ES_CENTER

Centers the text. This style is valid in multiline edit controls only.

ES_RIGHT

Justifies the text to the right. This style is valid in multiline edit controls only.

ES_LOWERCASE

Converts all characters to lowercase as they are typed into the edit control.

ES_UPPERCASE

Converts all characters to uppercase as they are typed into the edit control.

ES_PASSWORD

Displays all characters as an asterisk (*) as they are typed into the edit control. An application can use the EM_SETPASSWORDCHAR message to change the character that is displayed.

ES_MULTILINE

Multiple-line edit control. (The default is single-line.) Shows as many lines of text as possible. The following four styles specify options for horizontal and vertical scrolling.

ES_AUTOVSCROLL specified

Shows as many lines as possible and scrolls vertically when the user presses the ENTER key. (This is actually the carriage-return character, which the edit control expands to a carriage-return/line-feed combination.)

ES_AUTOVSCROLL not specified

Shows as many lines as possible and beeps if the user presses ENTER when no more lines can be displayed.

ES_AUTOHSCROLL specified

Scrolls horizontally when the insertion point goes past the right edge of the control. To start a new line, press the ENTER key.

ES_AUTOHSCROLL not specified

Wraps words to the beginning of the next line when necessary. A new line is also started if the user presses ENTER. If the window size changes, the word wrap position changes, and the text is redisplayed.

Multiple-line edit controls can have scroll bars. An edit control with scroll bars processes its own scroll-bar messages. Edit controls without scroll bars scroll as described above, and process any scroll messages sent by the parent window.

ES_AUTOVSCROLL

Scrolls text automatically up one page when the user presses the ENTER key on the last line.

ES_AUTOHSCROLL

Scrolls text automatically to the right by 10 characters when the user types a character at the end of the line. When the user presses the ENTER key, the control scrolls all text back to position 0.

ES_NOHIDESEL

Overrides the default action, in which an edit control hides the selection when the control loses the input focus. Inverts the selection instead.

ES_OEMCONVERT

Converts text entered in the edit control from the ANSI character set to the OEM character set and then back to ANSI. This ensures proper character conversion when the application calls the CharToOem function to convert an ANSI string in the edit control to OEM characters. This style is most useful for edit controls that contain filenames.

The Listbox Control Class

Listbox controls consist of a list of character strings. The control is used whenever an application needs to present a list of names, such as filenames, that the user can view and select. The user can select a string by pointing to the string with the mouse and clicking a mouse button. When a string is selected, it is highlighted and a notification message is passed to the parent window. A scroll bar can be used with a listbox control to scroll lists that are too long or too wide for the control window. Listbox control styles are described below.

LBS_STANDARD

Strings in the list box are sorted alphabetically and the parent window receives an input message whenever the user clicks or double-clicks a string. The list box contains borders on all sides.

LBS_DISABLENOSCROLL

Shows a disabled vertical scroll bar for the list box when the box does not contain enough items to scroll. If this style is not specified, the scroll bar is hidden when the list box does not contain enough items.

LBS_EXTENDEDSEL

The user can select multiple items using the mouse with the SHIFT and/or the CONTROL key or special key combinations.

LBS_HASSTRINGS

An owner-draw list box contains items consisting of strings. The list box maintains the memory and pointers for the strings so the application can use the LB_GETTEXT message to retrieve the text for a particular item.

LBS_NOTIFY

The parent receives an input message whenever the user clicks or double-clicks a string.

LBS_MULTIPLESEL

The string selection is toggled each time the user clicks or double-clicks the string. Any number of strings can be selected.

LBS_MULTICOLUMN

The list box contains multiple columns. The list box can be scrolled horizontally. The LB_SETCOLUMNWIDTH message sets the width of the columns.

LBS_NOINTEGRALHEIGHT

The size of the list box is exactly the size specified by the application when it created the list box. Normally, Windows sizes a list box so that the list box does not display partial items.

LBS_SORT

The strings in the list box are sorted alphabetically.

LBS_NOREDRAW

The list-box display is not updated when changes are made. This style can be changed at any time by sending a WM_SETREDRAW message.

LBS_OWNERDRAWFIXED

The owner of the list box is responsible for drawing its contents; the items in the list box are all the same height.

LBS_OWNERDRAWVARIABLE

The owner of the list box is responsible for drawing its contents; the items in the list box are variable in height.

LBS_USETABSTOPS

The list box is able to recognize and expand tab characters when drawing its strings. The default tab positions are set at every 32 dialog units. (A dialog unit is a horizontal or vertical distance. One horizontal dialog unit is equal to 1/4 of the current dialog base width unit. The dialog base units are computed from the height and width of the current system font. The GetDialogBaseUnits function returns the size of the dialog base units in pixels.)

LBS_WANTKEYBOARDINPUT

The owner of the list box receives WM_VKEYTOITEM or WM_CHARTOITEM  messages whenever the user presses a key when the list box has input focus. This allows an application to perform  special processing on the keyboard input.

The Scrollbar Control Class

A scroll-bar control is a rectangle that contains a scroll  thumb and has direction arrows at both ends. The scroll bar sends  a notification message to its parent whenever the user clicks the  mouse in the control. The parent is responsible for updating the thumb  position, if necessary. Scroll-bar controls have the same appearance  and function as the scroll bars used in ordinary windows. But unlike  scroll bars, scroll-bar controls can be positioned anywhere within  a window and used whenever needed to provide scrolling input for a  window. Scroll bar control styles are described below.

SBS_VERT

Vertical scroll bar. If neither SBS_RIGHTALIGN nor SBS_LEFTALIGN  is specified, the scroll bar has the height, width, and position given  in the CreateWindow function.

SBS_RIGHTALIGN

Used with SBS_VERT. The right edge of the scroll bar is aligned  with the right edge of the rectangle specified by the x, y,  width, and height values given in the CreateWindow function. The scroll bar has the default width for system scroll bars.

SBS_LEFTALIGN

Used with SBS_VERT. The left edge of the scroll bar is aligned  with the left edge of the rectangle specified by the x, y,  width, and height values given in the CreateWindow function. The scroll bar has the default width for system scroll bars.

SBS_HORZ

Horizontal scroll bar. If neither SBS_BOTTOMALIGN nor SBS_TOPALIGN  is specified, the scroll bar has the height, width, and position given  in the CreateWindow function.

SBS_TOPALIGN

Used with SBS_HORZ. The top edge of the scroll bar is aligned  with the top edge of the rectangle specified by the x, y,  width, and height values given in the CreateWindow  function. The scroll bar has the default height for system scroll  bars.

SBS_BOTTOMALIGN

Used with SBS_HORZ. The bottom edge of the scroll bar is aligned  with the bottom edge of the rectangle specified by the x, y,  width, and height values given in the CreateWindow function. The scroll bar has the default height for system scroll  bars.

SBS_SIZEBOX

Size box. If neither SBS_SIZEBOXBOTTOMRIGHTALIGN nor SBS_SIZEBOXTOPLEFTALIGN  is specified, the size box has the height, width, and position given  in the CreateWindow function.

SBS_SIZEBOXTOPLEFTALIGN

Used with SBS_SIZEBOX. The top-left corner of the size box  is aligned with the top-left corner of the rectangle specified by  the x, y,  width, and height values given  in the CreateWindow function. The size box has the default size  for system size boxes.

SBS_SIZEBOXBOTTOMRIGHTALIGN

Used with SBS_SIZEBOX. The bottom-right corner of the size  box is aligned with the bottom-right corner of the rectangle specified  by the x, y, width, and height values  given in the CreateWindow function. The size box has the default  size for system size boxes.

The Static Control Class

Static controls are simple text fields, boxes, and rectangles  that can be used to label, box, or separate other controls. Static  controls take no input and provide no output. Static control styles  are described below.

SS_LEFT

A simple rectangle displaying the given text flush left. The  text is formatted before it is displayed. Words that would extend  past the end of a line are automatically wrapped to the beginning  of the next line.

SS_CENTER

A simple rectangle displaying the given text centered. The  text is formatted before it is displayed. Words that would extend  past the end of a line are automatically wrapped to the beginning  of the next line.

SS_RIGHT

A simple rectangle displaying the given text flush right.  The text is formatted before it is displayed. Words that would extend  past the end of a line are automatically wrapped to the beginning  of the next line.

SS_LEFTNOWORDWRAP

A simple rectangle displaying the given text flush left. Tabs  are expanded, but words are not wrapped. Text that extends past the  end of a line is clipped.

SS_SIMPLE

A simple rectangle with a single line of text flush left.  The line of text cannot be shortened or altered in any way. (The control's  parent window or dialog box must not process the WM_CTLCOLOR message.)

SS_NOPREFIX

Removes any (&) characters and underlines the next character  in the string. Unless this style is specified, Windows will interpret  any (&) characters in the control's text to be accelerator prefix  characters. If a static control is to contain text where this feature  is not wanted, SS_NOPREFIX may be added. This STATIC-control style  may be included with any of the defined STATIC controls.
You can combine SS_NOPREFIX with other styles by using the  bitwise OR operator. This is most often used when filenames  or other strings that may contain an (&) need to be displayed in a  static control in a dialog box.

SS_ICON

An icon displayed in the dialog box. The given text is the  name of an icon (not a filename) defined elsewhere in the resource  file. For the ICON statement, the width and height  parameters in the CreateWindow function are ignored; the  icon automatically sizes itself.

SS_BLACKRECT

A rectangle filled with the color used to draw window frames.  This color is black in the default Windows color scheme.

SS_GRAYRECT

A rectangle filled with the color used to fill the screen  background. This color is gray in the default Windows color scheme.

SS_WHITERECT

A rectangle filled with the color used to fill window backgrounds.  This color is white in the default Windows color scheme.

SS_BLACKFRAME

Box with a frame drawn with the same color as window frames.  This color is black in the default Windows color scheme.

SS_GRAYFRAME

Box with a frame drawn with the same color as the screen background  (desktop). This color is gray in the default Windows color scheme.

SS_WHITEFRAME

Box with a frame drawn with the same color as window backgrounds.  This color is white in the default Windows color scheme.

SS_USERITEM

User-defined item.

CTEXT Control
~~~~~~~~~~~~~~
CTEXT text, id, x, y, width, height [, style [, extended-style]]
The CTEXT statement creates a centered-text control. The control is a simple rectangle displaying the given text centered in the rectangle. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line. The CTEXT statement, which you can use only in a DIALOG statement, defines the text, identifier, dimensions, and attributes of the control.

Parameters

text
Specifies text that is centered in the rectangular area of the control.

style
Specifies the control styles. This value can be any combination of the following styles: SS_CENTER, WS_TABSTOP, and WS_GROUP.
If you do not specify a style, the default style is SS_CENTER and WS_GROUP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "
Common Statement Parameters".

Example

This example creates a centered-text control that is labeled "filename":

CTEXT "filename", 101, 10, 10, 100, 100

See Also CONTROL, DIALOG, LTEXT, RTEXT

CURSOR Resource
~~~~~~~~~~~~~~~~
nameID CURSOR [load-mem] filename

The CURSOR statement specifies a bitmap that defines the shape of the cursor
on the display screen.

Parameters

- nameID     Specifies either a unique name or a 16-bit unsigned integer
             identifying the resource.

- load-mem   Specifies loading and memory attributes for the resource.
             For more information, see "Common Resource Attributes".

- filename   Specifies the name of the file that contains the resource.
             The name must be a valid filename; it must be a full path if
             the file is not in the current working directory.
             The path can either be a quoted or non-quoted string.

Comments
Icon and cursor resources can contain more than one image.
If the resource is marked with the PRELOAD option, Windows loads all images
in the resource when the application executes.

Example
The following example specifies two cursor resources; one by name
(cursor1) and the other by number (2):

cursor1 CURSOR bullseye.cur
2       CURSOR "d:\\cursor\\arrow.cur"

DEFPUSHBUTTON Control

 DEFPUSHBUTTON text, id, x, y, width, height [, style [, extended-style]]
 The DEFPUSHBUTTON statement creates a default push-button control. The control is a small rectangle with a bold outline that represents the default response for the user. The given text is displayed inside the button. The control highlights the button in the usual way when the user clicks the mouse in it and sends a message to its parent window.

Parameters

text

Specifies text that is centered in the rectangular area of the control.

style

Specifies the control styles. This value can be a combination of the following styles: BS_DEFPUSHBUTTON, WS_TABSTOP, WS_GROUP, and WS_DISABLED.
If you do not specify a style, the default style is BS_DEFPUSHBUTTON and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "
Common Statement Parameters".

Example

This example creates a default push-button control that is labeled "Cancel":

DEFPUSHBUTTON "Cancel", 101, 10, 10, 24, 50

See Also  PUSHBUTTON, RADIOBUTTON

DIALOG Resource
~~~~~~~~~~~~~~~~
nameID DIALOG [load-mem] x , y, width, height

[   optional-statements]

BEGIN
    control-statement
    . . .
END

The DIALOG statement defines a window that an application can use to create
dialog boxes. The statement defines the position and dimensions of the dialog
box on the screen as well as the dialog box style.

nameID
- Identifies the dialog box. This is either a unique name or a unique 16-bit
  unsigned integer value in the range 1 to 65,535.

load-mem
- Specifies loading and memory attributes for the resource.
  For more information, see "Common Resource Attributes".

option-statements
- Specifies options for the dialog box.
  This can be zero or more of the following statements:

CAPTION "text"
- Specifies the caption of the dialog box if it has a title bar.
  See CAPTION for more information.

CHARACTERISTICS dword
- Specifies a user-defined double-word value for use by resource tools.
  This value is not used by Windows.
  See CHARACTERISTICS for more information,.

CLASS class
- Specifies a 16-bit unsigned integer or a string, enclosed in double
  quotation marks, that identifies the class of the dialog box.
  See CLASS for more information.

LANGUAGE language,sublanguage
- Specifies the language of the dialog box.
  See LANGUAGE for more information.

STYLE styles
- Specifies the styles of the dialog box.
  See STYLE for more information.

EXSTYLE=extended-styles
- Specifies the extended styles of the dialog box.
  See EXSTYLE for more information.

VERSION dword
- Specifies a user-defined doubleword value. This statement is intended for
  use by additional resource tools and is not used by Windows.
  See VERSION for more information.

- For more information on the x, y, width, and height parameters,
  see "Common Statement Parameters".

Comments

- The GetDialogBaseUnits function returns the dialog base units in pixels.
  The exact meaning of the coordinates depends on the style defined by the
  STYLE option statement. For child-style dialog boxes, the coordinates are
  relative to the origin of the parent window, unless the dialog box has the
  style DS_ABSALIGN; in that case, the coordinates are relative to the origin
  of the display screen.
- Do not use the WS_CHILD style with a modal dialog box.
  The DialogBox function always disables the parent/owner of the newly
  created dialog box. When a parent window is disabled, its child windows
  are implicitly disabled. Since the parent window of the child-style dialog
  box is disabled, the child-style dialog box is too.
- If a dialog box has the DS_ABSALIGN style, the dialog coordinates for its
  upper-left corner are relative to the screen origin instead of to the
  upper-left corner of the parent window. You would typically use this style
  when you wanted the dialog box to start in a specific part of the display
  no matter where the parent window may be on the screen.

- The name DIALOG can also be used as the class-name parameter to the
  CreateWindow function to create a window with dialog box attributes.

Example

The following demonstrates the usage of the DIALOG statement:

#include

ErrorDialog DIALOG  10, 10, 300, 110
STYLE WS_POPUP|WS_BORDER
CAPTION "Error!"
BEGIN
    CTEXT "Select One:", 1, 10, 10, 280, 12
    PUSHBUTTON "&Retry", 2, 75, 30, 60, 12
    PUSHBUTTON "&Abort", 3, 75, 50, 60, 12
    PUSHBUTTON "&Ignore", 4, 75, 80, 60, 12
END

See Also  CONTROL, CreateDialog, CreateWindow, DialogBox, GetDialogBaseUnits
          Multiline Statements
          CHARACTERISTICS, LANGUAGE, VERSION
          ACCELERATORS, DIALOG, MENU, RCDATA, STRINGTABLE

DIALOGEX Resource       (Long chapitre  115 lignes  Jmm)
~~~~~~~~~~~~~~~~~~

   The DIALOGEX resource is an extension of the DIALOG resource.
   In addition to the functionality offered by DIALOG, DIALOGEX allows
   for the following:

 · Help IDs on the dialog itself as well as on controls within the dialog.
 · Use of the EXSTYLE statement for the dialog itself as well as on
   controls  within the dialog.
 · Font weight and italic settings for the font to be used in the dialog.
 · Control-specific data for controls within the dialog.
 · Use of the BEDIT, IEDIT, and HEDIT predefined system class names.

-*- Syntax

      nameID DIALOGEX [ load-mem] x, y, width, height [ , helpID]
      [ optional-statements]
     BEGIN
           control-statement
           . . .
     END

-*- Parameters

 - nameID   Identifies the dialog box.
            This is either a unique name or a unique 16-bit unsigned integer
            value in the range 1 to 65,535.

 - load-mem  Specifies loading and memory attributes for the resource.
             For more information, see Common Resource Attributes.

 - x        Specifies the location on the screen of the left side of the
            dialog, in dialog units.

 - y        Specifies the location on the screen of the top of the dialog,
            in dialog units.

 - width    Specifies the width of the dialog, in dialog units.

 - height   Specifies the height of the dialog, in dialog units.

 - helpID   Specifies a numeric expression indicating the ID used to
            identify the dialog during WM_HELP processing.

 - optional-statements   Specifies options for the dialog box.
            This can be zero or more of the following statements:

 - CAPTION "text"
            Specifies the caption of the dialog box if it has a title bar.
            See CAPTION for more information.

 - CHARACTERISTICS DWORD
            Specifies a user-defined DWORD value for use by resource tools.
            This value is not used by Windows.
            For more information see CHARACTERISTICS
 - CLASS class
            Specifies a 16-bit unsigned integer or a string, enclosed in
            double quotation marks ("), that identifies the class of the
            dialog box. See CLASS for more information.

 - EXSTYLE=extended-styles
            Specifies the extended styles of the dialog box.
            See EXSTYLE for more information.

 - FONT pointsize, typeface, weight, italic

    -   pointsize   Specifies the size, in points, of the font.

    -   typeface    Specifies the name of the typeface.
                    This name must be identical to the name defined in the
                    [FONTS] section of WIN.INI.  This parameter must be
                    enclosed in double quotation marks (").

    -   weight      Specifies a numeric expression for the font weight
                    (explicit FW_* values defined in WINGDI.H can be used by
                    adding an include to the RC file: #include "WINGDI.H")

    -   italic      Indicates whether the font should be italic or not.
                    Specify either TRUE or FALSE for the italic value.

    -   LANGUAGE language, sublanguage
                    Specifies the language of the dialog box.
                    See LANGUAGE for more information.

    -  MENU menuname
                    Specifies the menu to use. This value is either the name
                    of the menu or the integer identifier.

    -  STYLE styles
                    Specifies the styles of the dialog box.
                    See STYLE for more information.

    - VERSION DWORD
                    Specifies a user-defined DWORD value. This statement is
                    intended for use by additional resource tools and is not
                    used by Windows. For more information, see VERSION

  The DIALOGEX body is marked with a BEGIN statement at the beginning of the
  body and an END statement at the end of the body. The body is made up of
  any number of control statements.
  There are four families of control statements:
  generic, static, button, and edit.
  While each of these families uses a different syntax for defining specific
  features of its controls, they all share a common syntax for defining the
  position, size, extended styles, help identification number, and
  control-specific data. That common syntax is:

    (controlType), x, y, cx, cy [, [exStyle] [, helpID]
    [BEGIN
        data-element-1 [,
        data-element-2 [,
        ... ]]
    END]

    (controlType)
    Family-specific definition ¾ described below.

 -  x
       Specifies the location in the dialog of the left side of the control,
       in dialog units.

 -  y
       Specifies the location in the dialog of the top of the control,
       in dialog units.

 - cx
       Specifies the width of the control, in dialog units.

 - cy
       Specifies the height of the control, in dialog units.

 - exStyle
       Specifies any number of extended window styles (explicit WS_EX_*
       style values defined in winuser.h can be used by adding an include
       to the RC file: #include "winuser.h")

 - helpID
       Specifies a numeric expression indicating the ID used to identify the
       control during WM_HELP processing.

 - controlData
       Marked by a nested BEGIN and END, specifies the control-specific data
       for the control. When a dialog is created, and a control in that
       dialog which has control-specific data is created, a pointer to that
       data is passed into the control's window procedure via the lParam to
       the WM_CREATE message for that control.

 Following is the family-specific syntax of the (controlType):

   Generic control:

   CONTROL controlText, id, className, style

   - controlText  Specifies the window text for the control.
                  For more information, see Common Statement Parameters.
   - id           Specifies the control identifier.
                  For more information, see Common Statement Parameters.
   - className    Specifies the name of the class. This may be either a
                  string enclosed in double quotation marks (") or one of
                  the following predefined system classes:
                  BUTTON, STATIC, EDIT, LISTBOX, SCROLLBAR, or COMBOBOX.
   - style        Specifies the window styles (explicit WS_*, BS_*, SS_*,
                  ES_*, LBS_*, SBS_*, and CBS_* style values defined in
                  WINUSER.H can be used by adding an include to the RC file:
                  #include "WINUSER.H")

   Static control:

   staticClass controlText, id

   staticClass {LTEXT | RTEXT | CTEXT}

   - controlText  Specifies the window text for the control.
                  For more information, see "Common Statement Parameters".
   - id           Specifies the control identifier.
                  For more information, see "Common Statement Parameters".

   Button control:

   buttonClass controlText, id

   buttonClass {AUTO3STATE | AUTOCHECKBOX | AUTORADIOBUTTON | CHECKBOX |
                PUSHBOX | PUSHBUTTON | RADIOBUTTON | STATE3 | USERBUTTON}

   - controlText  Specifies the window text for the control.
                  For more information, see "Common Statement Parameters".
   - id           Specifies the control identifier.
                  For more information, see "Common Statement Parameters".

  Edit control:

  editClass id

  editClass {EDITTEXT | BEDIT | HEDIT | IEDIT}

  id   Specifies the control identifier.
       For more information, see "Common Statement Parameters".

  Arithmetic and Boolean Operations
  Valid operations that may be contained in any of the numeric expressions
  in the statements of DIALOGEX are:

    ·   Add ('+')
    ·   Subtract ('-')
    ·   Unary minus ('-')
    ·   Unary NOT ('~')
    ·   AND ('&')
    ·   OR ('|')

See Also CONTROL, CreateDialog, CreateWindow, DialogBox, GetDialogBaseUnits,
         Multiline Statements, ACCELERATORS, CHARACTERISTICS, LANGUAGE,
         MENU, RCDATA, STRINGTABLE, VERSION

EDITTEXT Control
~~~~~~~~~~~~~~~~

     EDITTEXT text, id, x, y, width, height [, style [, extended-style]]

 The EDITTEXT statement defines an EDIT control belonging to the EDIT class.
 It creates a rectangular region in which the user can type and edit text.
 The control displays a cursor when the user clicks the mouse in it.
 The user can then use the keyboard to enter text or edit the existing text.
 Editing keys include the BACKSPACE and DELETE keys.
 The user can also use the mouse to select characters to be deleted or to
 select the place to insert new characters.

 Parameters

 style Specifies the control styles.
       This value can be a combination of the edit class styles and the
       following styles: WS_TABSTOP, WS_GROUP, WS_VSCROLL, WS_HSCROLL, and
       WS_DISABLED.
       If you do not specify a style, the default style is ES_LEFT,
       WS_BORDER, and WS_TABSTOP.

 For more information on the text, id, x, y, width, height, style, and
 extended-style parameters, see "Common Statement Parameters".

 Example ..
 The following example demonstrates the use of the EDITTEXT statement:

                    EDITTEXT  3, 10, 10, 100, 10

EXSTYLE Statement
~~~~~~~~~~~~~~~~~
 EXSTYLE extended-style
 The EXSTYLE command allows you to designate a dialog box with the
 WS_EX_style styles. In a resource definition, the EXSTYLE statement is
 placed with the optional statements before the BEGIN keyword.
 It can also be placed with the load-mem parameters in a DIALOG statement
 as follows:
             name DIALOG  [load-mem] EXSTYLE=extended-style  x, y, ...

 For controls, extended styles are specified after the style option in any
 control definition, as follows:

         control text, id, x, y, width, height, [style[, extended-style]]

 Parameters    extended-style

 The WS_EX_style style for the dialog box or control.

 See also    ACCELERATORS, CONTROL, DIALOG, MENU, POPUP, RCDATA,
             STRINGTABLE, User-Defined Resouce

FONT Resource
~~~~~~~~~~~~~~
nameID FONT [load-mem] filename
The FONT resource-definition statement specifies a file that contains a font.
For a font resource, nameID must be a number; it cannot be a name.

--Parameters

 nameID
 Specifies either a unique name or a 16-bit unsigned integer value identifying
 the resource.

 load-mem
 Specifies loading and memory attributes for the resource.
 For more information, see "Common Resource Attributes".

 filename
 Specifies the name of the file that contains the resource.
 The name must be a valid filename; it must be a full path if the file is not
 in the current working directory. The path can either be a quoted or
 non-quoted string.

- Example ..  The following example specifies a single font resource:

 5 FONT  CMROMAN.FNT

 See also  FONT Statement

FONT Statement
~~~~~~~~~~~~~~

 FONT pointsize, typeface

 The FONT statement defines the font with which Windows will draw text in
 the dialog box. The font must have been previously loaded, either from
 the WIN.INI file or by calling the LoadResource function.

- Parameters

  pointsize
  Specifies the size, in points, of the font.

  typeface
  Specifies the name of the typeface.
  This name must be identical to the name defined in the [fonts] section of
  WIN.INI. This parameter must be enclosed in double quotes.

- Example .. The following example demonstrates the use of the FONT statement:

  FONT 12, "MS Sans Serif"

  See Also   DIALOG, FONT Resource, LoadResource

GROUPBOX Control
~~~~~~~~~~~~~~~~~~

 GROUPBOX text, id, x, y, width, height [, style [, extended-style]]

 The GROUPBOX statement creates a group box control.
 The control is a rectangle that groups other controls together.
 The controls are grouped by drawing a border around them and displaying the
 given text in the upper-left corner.
 The GROUPBOX statement, which you can use only in a DIALOG statement,
 defines the text, identifier, dimensions, and attributes of a control window.
 When the style contains WS_TABSTOP or the text specifies an accelerator,
 tabbing or pressing the accelerator key moves the focus to the first control
 within the group.

- Parameters

 style
 Specifies the control styles. This value can be a combination of the button
 class style BS_GROUPBOX and the WS_TABSTOP and WS_DISABLED styles.
 If you do not specify a style, the default style is BS_GROUPBOX.

 For more information on the text, id, x, y, width, height, style, and
 extended-style parameters, see "Common Statement Parameters".

- Example ..This example creates a group-box control that is labeled Options:

 GROUPBOX "Options", 101, 10, 10, 100, 100

 See Also  DIALOG

ICON Resource
~~~~~~~~~~~~~~
nameID ICON [load-mem] filename
The ICON resource-definition statement specifies a bitmap that defines the
shape of the icon to be used for a given application.

Parameters

- nameID      Specifies either a unique name or a 16-bit unsigned integer
              value identifying the resource.
- load-mem    Specifies loading and memory attributes for the resource.
              For more information, see "Common Resource Attributes".
- filename    Specifies the name of the file that contains the resource.
              The name must be a valid filename;  it must be a full path
              if the file is not in the current working directory.
              The path can either be a quoted or non-quoted string.
Comments
Icon and cursor resources can contain more than one image.
If the resource is marked as PRELOAD, Windows loads all images in the
resource when the application executes.

Example .. The following example specifies two icon resources:

desk1   ICON desk.ico
11      ICON DISCARDABLE custom.ico

ICON Control
~~~~~~~~~~~~
ICON text, id, x, y, [width, height, style [, extended-style]]

The ICON statement creates an icon control. This control is an icon displayed
in a dialog box. The ICON control statement, which you can use only in a
DIALOG statement, defines the icon-resource identifier, icon-control
identifier, position, and attributes of a control.

- Parameters

 text
 Specifies the name of an icon (not a filename) defined elsewhere in the
 resource file.

 width
 This value is ignored and should be set to zero.

 height
 This value is ignored and should be set to zero.

 style
 Specifies the control style. This parameter is optional.
 The only value that can be specified is the SS_ICON style.
 This is the default style whether this parameter is specified or not.

 For more information on the text, id, x, y, width, height, style, and
 extended-style parameters, see "Common Statement Parameters".

 Example ..  This example creates an icon control whose icon identifier
            is 901 and whose name is "myicon":

            ICON "myicon" 901, 30, 30

See Also  DIALOG, ICON Resource

LANGUAGE Statement
~~~~~~~~~~~~~~~~~~
LANGUAGE language, sublanguage
The LANGUAGE statement sets the language for all resources up to the next
LANGUAGE statement or to the end of the file.
When the LANGUAGE statement appears before the BEGIN in an ACCELERATORS,
DIALOG, MENU, RCDATA, or STRINGTABLE resource definition, the specified
language applies only to that resource.

Parameters

language

Language identifier. Must be one of the constants from WINNLS.H

sublanguage

Sublanguage identifier. Must be one of the constants from WINNLS.H

See Also    Multiline Statements, CHARACTERISTICS, LANGUAGE, VERSION
            ACCELERATORS, DIALOG, MENU, RCDATA, STRINGTABLE

LISTBOX Control
~~~~~~~~~~~~~~~~
LISTBOX text, id, x, y, width, height [, style [, extended-style]]
The LISTBOX statement creates commonly used controls for a dialog box or window. The control is a rectangle containing a list of strings (such as filenames) from which the user can select. The LISTBOX statement, which can only be used in a DIALOG or WINDOW statement, defines the identifier, dimensions, and attributes of a control window.

Parameters

style

Specifies the control styles. This value can be a combination of the list-box class styles and any of the following styles: WS_BORDER and WS_VSCROLL.
If you do not specify a style, the default style is LBS_NOTIFY and WS_BORDER.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "Common Statement Parameters".

Example

This example creates a list-box control whose identifier is 101:

LISTBOX 101, 10, 10, 100, 100

See Also   COMBOBOX, DIALOG

LTEXT Control

LTEXT text, id, x, y, width, height [, style [, extended-style]]
The LTEXT statement creates a left-aligned text control. The control is a simple rectangle displaying the given text left-aligned in the rectangle. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line. The LTEXT statement, which can be used only in a DIALOG statement, defines the text, identifier, dimensions, and attributes of the control.

Parameters

style

Specifies the control styles. This value can be any combination of the BS_RADIOBUTTON style and the following styles: SS_LEFT, WS_TABSTOP, and WS_GROUP.
If you do not specify a style, the default style is SS_LEFT and WS_GROUP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "
Common Statement Parameters".

Example

This example creates a left-aligned text control that is labeled "Filename":

LTEXT "Filename", 101, 10, 10, 100, 100

See Also

CONTROL, DIALOG, CTEXT, RTEXT

MENU Resource                                          ; IDentificateur
~~~~~~~~~~~~~~
menuID MENU [load-mem]  [optional-statements]
BEGIN
    item-definitions
    . . .
END
The MENU statement defines the contents of a menu resource.
A menu resource is a collection of information that defines the appearance
and function of an application menu. A menu is a special input tool that
lets a user select commands from a list of command names.

Parameters

menuID
Identifies the menu. This value is either a unique string or a unique 16-bit
unsigned integer value in the range of 1 to 65,535.

load-mem
Specifies loading and memory attributes for the resource.
For more information, see "Common Resource Attributes".

optional-statements

Zero or more of the following statements:

Statement   Decription
CHARACTERISTICS dword   User-defined information about a resource that can
be used by tools that read and write resource files.
LANGUAGE language, sublanguage  Specifies the language for the resource.
The parameters are constants from WINNLS.H. VERSION dword   User-defined
version number for the resource that can be used by tools that read and
write resource files.

Example .. Following is an example of a complete MENU statement:

sample MENU  (,GRAYED       jmm pour optional-stat. voir PaintBrush31)
BEGIN
     MENUITEM "&Soup", 100
     MENUITEM "S&alad", 101
     POPUP "&Entree"
     BEGIN
          MENUITEM "&Fish", 200
          MENUITEM "&Chicken", 201, CHECKED
          POPUP "&Beef"
          BEGIN
               MENUITEM "&Steak", 301
               MENUITEM "&Prime Rib", 302
          END
     END
     MENUITEM "&Dessert", 103
END

See Also   MENUITEM, POPUP Multiline Statements CHARACTERISTICS, LANGUAGE,
           VERSION ACCELERATORS, DIALOG, MENU, RCDATA, STRINGTABLE

MENU Statement
~~~~~~~~~~~~~~
MENU menuname
The MENU statement defines the dialog box's menu. If no statement is given,
the dialog box has no menu.

Parameter

menuname
Specifies the menu to use. This value is either the name of the menu or the
integer identifier of the menu.

Example
The following example demonstrates the use of the MENU dialog statement:

MENU errmenu

MENUEX Statement      MENUEX Resource (2 titres ??)
~~~~~~~~~~~~~~~~

The MENUEX resource is an extension of the MENU resource. In addition to the
functionality offered by MENU, MENUEX allows for the following:

·   Help IDs on popup menus.
·   IDs on popup menus.
·   Use of the menu type and state flags created for Windows 95
    (MFT_* type flags and MFS_* state flags).

Syntax

menuID MENUEX
BEGIN
    [{[MENUITEM itemText [, [id] [, [type] [, state]]]] |
      [POPUP    itemText [, [id] [, [type] [,[state] [, helpID]]]]
    BEGIN
        popupBody
    END]} ...]
END

Parameters

MENUITEM statement

Defines a normal menu item

itemText
 Specifies the string containing the text for the menu item.
 For more information, see MENUITEM.

id
 Specifies a numeric expression indicating the ID of the menu item.

type
 Specifies a numeric expression indicating the type of the menu item
 (explicit MFT_* type values defined in WINUSER.H can be used by adding an
 include to the RC file: #include "WINUSER.H")

state
 Specifies a numeric expression indicating the state of the menu item
 (explicit MFS_* state values defined in WINUSER.H can be used by adding an
 include to the RC file: #include "WINUSER.H")

POPUP statement
 Defines a menu item which has another menu (a submenu) associated with it.

itemText
 Specifies a string containing the text for the menu item.

id
 Specifies a numeric expression indicating the ID of the menu item.

type
 Specifies a numeric expression indicating the type of the menu item
 (explicit MFT_* type values defined in WINUSER.H can be used by adding an
 include to the RC file: #include "WINUSER.H").

state
 Specifies a numeric expression indicating the state of the menu item
 (explicit MFS_* state values defined in WINUSER.H can be used by adding an
 include to the RC file: #include "WINUSER.H").

helpID
 Specifies a numeric expression indicating the ID used to identify the menu
 during WM_HELP processing.

popupBody
 Contain any combination of the MENUITEM and POPUP statements described above.

Remarks
 Valid arithmetic and Boolean operations that may be contained in any of the
 numeric expressions in the statements of MENUEX are:

 ·  Add ('+')
 ·  Subtract ('-')
 ·  Unary minus ('-')
 ·  Unary NOT ('~')
 ·  AND ('&')
 ·  OR ('|')

See Also   MENU, MENUITEM, POPUP  Multiline Statements ACCELERATORS,
           CHARACTERISTICS, DIALOG, LANGUAGE, RCDATA, STRINGTABLE,VERSION

MENUITEM Statement
~~~~~~~~~~~~~~~~~~
MENUITEM text, result, [optionlist]
MENUITEM SEPARATOR
The MENUITEM statement defines a menu item.

- Parameters

text
Specifies the name of the menu item.
The string can contain the escape characters \t and \a.
The \t character inserts a tab in the string and is used to align text in
columns.Tab characters should be used only in pop-up menus, not in menu bars.
(For information on pop-up menus, see the POPUP statement.)
The \a character aligns all text that follows it flush right to the menu
bar or pop-up menu.

- result
Specifies the result generated when the user selects the menu item.
This parameter takes an integer value. Menu-item results are always integers;
when the user clicks the menu-item name, the result is sent to the window
that owns the menu.

- optionlist
Specifies the appearance of the menu item. This optional parameter takes one
or more redefined menu options, separated by commas or spaces.
The menu options are as follows:

CHECKED
Item has a check mark next to it.

GRAYED
Item name is initially inactive and appears on the menu in gray or a
lightened shade of the menu-text color.

HELP
Identifies a help item.

INACTIVE
Item name is displayed but it cannot be selected.

MENUBARBREAK
Same as MF_MENUBREAK except that for pop-up menus, it separates the new
column from the old column with a vertical line.

MENUBREAK
Places the menu item on a new line for static menu-bar items.
For pop-up menus, it places the menu item in a new column with no dividing
line between the columns.

The INACTIVE and GRAYED options cannot be used together.

SEPARATOR
The MENUITEM SEPARATOR form of the MENUITEM statement creates an inactive
menu item that serves as a dividing bar between two active menu items in a
pop-up menu.

Example
The following example demonstrates the use of the MENUITEM and MENUITEM
SEPARATOR statements:

 MENUITEM "&Roman", 206, CHECKED, GRAYED
 MENUITEM SEPARATOR
 MENUITEM "&Blackletter", 301

See Also  MENU, POPUP  ---------------------------------------------------

MESSAGETABLE Resource
~~~~~~~~~~~~~~~~~~~~~~
nameID MESSAGETABLE filename
The MESSAGETABLE resource-deinition statement defines the ID and file of an
application's message table resource. Message tables are special string
resources used in event logging and with the FormatMessage API.
The file contains a binary message table generated by the Message Compiler.
The Message Compiler also generates a resource script file that contains the
MESSAGETABLE statements you need to include the message table resources in
the compiled resource file. Use the #include directive to include this
resource script into your main resource script.

Parameters

nameID
Specifies either a unique name or a 16-bit unsigned integer value
identifying the resource.

filename
Specifies the name of the file that contains the resource.
The name must be a valid filename; it must be a full path if the file is not
in the current working directory. The path can either be a quoted or
non-quoted string.

See Also   STRINGTABLE Resource, Message Compiler

POPUP Resource
~~~~~~~~~~~~~~~~
POPUP text, [optionlist]
BEGIN
    item-definitions
    .
    .
    .
END
The POPUP statement marks the beginning of the definition of a pop-up menu.
A pop-up menu (which is also known as a drop-down menu) is a special menu
item that displays a sublist of menu items when it is selected.

Parameters

text
Specifies the name of the pop-up menu. This string must be enclosed in
double quotation marks.

optionlist
Specifies one or more redefined menu options that specify the appearance of
the menu item. The menu options follow:

CHECKED
Item has a check mark next to it. This option is not valid for a top-level
pop-up menu.

GRAYED
Item name is initially inactive and appears on the menu in gray or a
lightened shade of the menu-text color.

INACTIVE
Item name is displayed but it cannot be selected.

MENUBARBREAK
Same as MF_MENUBREAK except that for pop-up menus, it separates the new
column from the old column with a vertical line.

MENUBREAK
Places the menu item on a new line for static menu-bar items.
For pop-up menus, it places the menu item in a new column with no dividing
line between the columns.

The INACTIVE and GRAYED options cannot be used together.

Example .. The following example demonstrates the use of the POPUP statement:

chem MENU
BEGIN
    POPUP "&Elements"
    BEGIN
         MENUITEM "&Oxygen", 200
         MENUITEM "&Carbon", 201, CHECKED
         MENUITEM "&Hydrogen", 202
         MENUITEM SEPARATOR
         MENUITEM "&Sulfur", 203
         MENUITEM "Ch&lorine", 204
    END
    POPUP "&Compounds"
    BEGIN
         POPUP "&Sugars"
         BEGIN
            MENUITEM "&Glucose", 301
            MENUITEM "&Sucrose", 302, CHECKED
            MENUITEM "&Lactose", 303, MENUBREAK
            MENUITEM "&Fructose", 304
         END
         POPUP "&Acids"
         BEGIN
              "&Hydrochloric", 401
              "&Sulfuric", 402
         END
    END
END

See Also   MENU, MENUITEM

PUSHBOX Control
~~~~~~~~~~~~~~~~

    PUSHBOX text, id, x, y, width, height [, style [, extended-style]]

The PUSHBOX statement creates a push-box control. Identical to a PUSHBUTTON,
except that it does not display a button face or frame;only the text appears.

Parameters

style
- Specifies styles for the pushbox, which can be a combination of the
  BS_PUSHBOX style and the following styles: WS_TABSTOP, WS_DISABLED,
  and WS_GROUP.

  The default style is BS_PUSHBOX and WS_TABSTOP.

- For more information on the text, id, x, y, width, height, style, and
  extended-style parameters, see "Common Statement Parameters".

See Also   PUSHBUTTON

PUSHBUTTON Control
~~~~~~~~~~~~~~~~~~

     PUSHBUTTON text, id, x, y, width, height [, style [, extended-style]]

 The PUSHBUTTON statement creates a push-button control.
 The control is a round-cornered rectangle containing the given text.
 The text is centered in the control.
 The control sends a message to its parent whenever the user chooses
 the control.

Parameters

- style  Specifies styles for the pushbutton, which can be a combination of
  the BS_PUSHBUTTON style and the following styles: WS_TABSTOP, WS_DISABLED,
  and WS_GROUP.
  The default style is BS_PUSHBUTTON and WS_TABSTOP.

- For more information on the text, id, x, y, width, height, style, and
  extended-style parameters, see "Common Statement Parameters".

Example

The following example demonstrates the use of the PUSHBUTTON statement:

PUSHBUTTON "ON", 7, 10, 10, 20, 10

See Also  GetDialogBaseUnits

RADIOBUTTON Control
~~~~~~~~~~~~~~~~~~~~

   RADIOBUTTON text, id, x, y, width, height [, style [, extended-style]]

The RADIOBUTTON statement creates a radio-button control. The control is a
small circle that has the given text displayed next to it, typically to its
right. The control highlights the circle and sends a message to its parent
window when the user selects the button. The control removes the highlight
and sends a message when the button is next selected.

Parameters

- style  Specifies styles for the radio button, which can be a combination
  of BUTTON-class styles and the following styles:
  WS_TABSTOP, WS_DISABLED, and WS_GROUP.

- The default style for RADIOBUTTON is BS_RADIOBUTTON and WS_TABSTOP.

- For more information on the text, id, x, y, width, height, style, and
  extended-style parameters, see "Common Statement Parameters".

Example

The following example demonstrates the use of the RADIOBUTTON statement:

RADIOBUTTON "Italic", 100, 10, 10, 40, 10

See Also  GetDialogBaseUnits

RCDATA Resource
~~~~~~~~~~~~~~~~
nameID RCDATA [load-mem] [optional-statements]
BEGIN
    raw-data
    . . .
END
The RCDATA statement defines a raw data resource for an application.
Raw data resources permit the inclusion of binary data directly in the
executable file.

Parameters

nameID
Specifies either a unique name or a 16-bit unsigned integer value that
identifies the resource.

load-mem
Specifies loading and memory attributes for the resource.
For more information, see "Common Resource Attributes".

optional-statements
Zero or more of the following statements:

Statement   Decription
CHARACTERISTICS dword   User-defined information about a resource that can
be used by tools that read and write resource files.
LANGUAGE language, sublanguage  Specifies the language for the resource.
The parameters are constants from WINNLS.H.
VERSION dword   User-defined version number for the resource that can be
used by tools that read and write resource files.

raw-data
Specifies raw data consisting of one or more integers or strings of characters. Integers can be specified in decimal, octal, or hexadecimal format. RC does not automatically append a terminating null character to a string. The string is a sequence of the specified ANSI (byte) characters unless explicitly qualified as a wide-character string with the L prefix. Strings in all resources other than RCDATA and user-defined resources are Unicode strings.
The block of data begins on a DWORD boundary and RC performs no padding or alignment of data within the raw-data block. It is the programmer's responsibility to ensure the proper alignment of data within the block.

Example ..
The following example demonstrates the use of the RCDATA statement:

resname RCDATA
BEGIN
   L"Here is a Unicode string\0", /* A Unicode string. Note: explicitly
                                 null-terminated */
   1024,                  /* int        */
   0x029a,                /* hex int    */
   0o733,                 /* octal int  */
   "\07"                  /* octal byte */
END

See Also  Multiline Statements CHARACTERISTICS, LANGUAGE, VERSION
          ACCELERATORS, DIALOG, MENU, RCDATA, STRINGTABLE

RTEXT Control
~~~~~~~~~~~~~~

   RTEXT text, id, x, y, width, height [, style [, extended-style]]

- The RTEXT statement creates a right-aligned text control. The control is a
  simple rectangle displaying the given text right-aligned in the rectangle.
  The text is formatted before it is displayed. Words that would extend past
  the end of a line are automatically wrapped to the beginning of the next line.

Parameters

- style  Specifies styles for the text control, which can be any combination
         of the following: WS_TABSTOP and WS_GROUP.
         The default style for RTEXT is SS_RIGHT and WS_GROUP.
      -  For more information on the text, id, x, y, width, height, style,
         and extended-style parameters, see "Common Statement Parameters".

Example  The following example demonstrates the use of the RTEXT statement:

         RTEXT "Number of Messages", 4, 30, 50, 100, 10

See Also  CONTROL, CTEXT, DIALOG, LTEXT

SCROLLBAR Control
~~~~~~~~~~~~~~~~~~
SCROLLBAR text, id, x, y, width, height [, style [, extended-style]]
The SCROLLBAR statement creates a scroll-bar control.
The control is a rectangle that contains a scroll box and has direction
arrows at both ends. The scroll-bar control sends a notification message
to its parent whenever the user clicks the mouse in the control.
The parent is responsible for updating the scroll-box position.
Scroll-bar controls can be positioned anywhere in a window and used whenever
needed to provide scrolling input.

Parameters

style
Specifies a combination (or none) of the following styles: WS_TABSTOP,
WS_GROUP, and WS_DISABLED.
In addition to these styles, the style parameter may contain a combination
(or none) of the SCROLLBAR-class styles.
The default style for SCROLLBAR is SBS_HORZ.

For more information on the text, id, x, y, width, height, style, and
extended-style parameters, see "Common Statement Parameters".

Example
The following example demonstrates the use of the SCROLLBAR statement:

SCROLLBAR 999, 25, 30, 10, 100

STATE3 Control
~~~~~~~~~~~~~~~~
STATE3  text, id, x, y, width, height [, style [, extended-style]]
The STATE3 statement defines a 3-state check box control.
The control is identical to a CHECKBOX, except that it has three states:
checked, unchecked, and disabled (grayed).

Parameters

text
Specifies text that is displayed to the right of the control.

style
Specifies the control styles. This value can be a combination of the button
class style BS_3STATE and the WS_TABSTOP and WS_GROUP styles.
If you do not specify a style, the default style is BS_3STATE and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and
extended-style parameters, see "Common Statement Parameters".

See Also  AUTOCHECKBOX, CHECKBOX, CONTROL

STRINGTABLE Resource
~~~~~~~~~~~~~~~~~~~~~~

STRINGTABLE [load-mem] [optional-statements]
BEGIN
    stringID string
    . . .
END

The STRINGTABLE statement defines one or more string resources for an
application. String resources are simply null-terminated Unicode strings
that can be loaded when needed from the executable file, using the LoadString
function.

Parameter

load-mem
Specifies loading and memory attributes for the resource.
For more information, see "Common Resource Attributes".

optional-statements
Zero or more of the following statements:

Statement   Decription
CHARACTERISTICS dword   User-defined information about a resource that can
be used by tools that read and write resource files.
ANGUAGE language, sublanguage   Specifies the language for the resource.
The parameters are constants from WINNLS.H.
VERSION dword   User-defined version number for the resource that can be
used by tools that read and write resource files.

stringID
Specifies an unsigned 16-bit integer that identifies the resource.

string
Specifies one or more strings, enclosed in double quotation marks.
The string must be no longer than 255 characters and must occupy a single
line in the source file. To add a carriage return to the string, use this
character sequence: \012. For example, "Line one\012Line two" would define
a string that would be displayed as follows:

Line one
Line two

Comments
rouping strings in separate sections allows all related strings to be read
in at one time and discarded together. When possible, an application should
make the table movable and discardable. RC allocates 16 strings per section
and uses the identifier value to determine which section is to contain the
string. Strings with the same upper-12 bits in their identifiers are placed
in the same section.

Example
The following example demonstrates the use of the STRINGTABLE statement:

#define IDS_HELLO    1
#define IDS_GOODBYE  2

STRINGTABLE
BEGIN
    IDS_HELLO,   "Hello"
    IDS_GOODBYE, "Goodbye"
END

See Also    Multiline Statements CHARACTERISTICS, LANGUAGE, VERSION
            ACCELERATORS, DIALOG, MENU, RCDATA, STRINGTABLE

STYLE Statement
~~~~~~~~~~~~~~~~
- STYLE style
  The STYLE statement defines the window style of the dialog box.
  The window style specifies whether the box is a pop-up or a child window.
  The default style has the following attributes:
  WS_POPUP, WS_BORDER, and WS_SYSMENU.

  Parameter
            style   Specifies the window style.
            ~~~~~   This parameter takes an integer value or redefined name.
                    The following lists the redefined styles:

DS_LOCALEDIT

  Specifies that edit controls in the dialog box will use memory in the
  application's data section. By default, all edit controls in dialog boxes
  use memory outside the application's data section. This feature can be
  suppressed by adding the DS_LOCALEDIT flag to the STYLE command for the
  dialog box. If this flag is not used, EM_GETHANDLE and EM_SETHANDLE
  messages must not be used since the storage for the control is not in the
  application's data section. This feature does not affect edit controls
  created outside of dialog boxes.

DS_MODALFRAME

 Creates a dialog box with a modal dialog box frame that can be combined with
 a title bar and System menu by specifying the WS_CAPTION et WS_SYSMENU styles.

DS_NOIDLEMSG

  Suppresses WM_ENTERIDLE messages that Windows would otherwise send to the
  owner of the dialog box while the dialog box is displayed.

DS_SYSMODAL

  Creates a system-modal dialog box.

WS_BORDER

  Creates a window that has a border.

WS_CAPTION

  Creates a window that has a title bar (implies the WS_BORDER style).

WS_CHILD

  Creates a child window. It cannot be used with the WS_POPUP style.

WS_CHILDWINDOW

  Creates a child window that has the WS_CHILD style.

WS_CLIPCHILDREN

  Excludes the area occupied by child windows when drawing within the parent
  window. Used when creating the parent window.

WS_CLIPSIBLINGS

  Clips child windows relative to each other; that is, when a particular
  child window receives a WM_PAINT message, this style clips all other
  top-level child windows out of the region of the child window to be
  updated. (If the WS_CLIPSIBLINGS style is not given and child windows
  overlap, it is possible, when drawing in the client area of a child window,
  to draw in the client area of a neighboring child window.)
  For use with the  WS_CHILD style only.

WS_DISABLED

  Creates a window that is initially disabled.

WS_DLGFRAME

  Creates a window with a modal dialog box frame but no title.

WS_GROUP

  Specifies the first control of a group of controls in which the user can
  move from one control to the next by using the arrow keys.
  All controls defined with the WS_GROUP style after the first control
  belong to the same group.
  The next control with the WS_GROUP style ends the style group and starts
  the next group (that is, one group ends where the next begins).
  This style is valid only for controls.

WS_HSCROLL

  Creates a window that has a horizontal scroll bar.

WS_ICONIC

  Creates a window that is initially iconic.
  For use with the WS_OVERLAPPED style only.

WS_MAXIMIZE

  Creates a window of maximum size.

WS_MAXIMIZEBOX

  Creates a window that has a Maximize box.

WS_MINIMIZE

  Creates a window of minimum size.

WS_MINIMIZEBOX

  Creates a window that has a Minimize box.

WS_OVERLAPPED

 Creates an overlapped window.An overlapped window has a caption and a border.

WS_OVERLAPPEDWINDOW

 Creates an overlapped window having the WS_OVERLAPPED,WS_CAPTION,WS_SYSMENU,
 WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles.

WS_POPUP

 Creates a pop-up window. It cannot be used with the WS_CHILD style.

WS_POPUPWINDOW

 Creates a pop-up window that has the WS_POPUP, WS_BORDER, and WS_SYSMENU
 styles. The WS_CAPTION style must be combined with the WS_POPUPWINDOW style
 to make the System menu visible.

WS_SIZEBOX

 Creates a window that has a size box. Used only for windows with a title
 bar or with vertical and horizontal scroll bars.

WS_SYSMENU

 Creates a window that has a System-menu box in its title bar.
 Used only for windows with title bars. If used with a child window,
 this style creates a Close box instead of a System-menu box.

WS_TABSTOP

 Specifies one of any number of controls through which the user can move
 by using the TAB key. The TAB key moves the user to the next control
 specified by the WS_TABSTOP style. This style is valid only for controls.

WS_THICKFRAME

 Creates a window with a thick frame that can be used to size the window.

WS_VISIBLE

 Creates a window that is initially visible.  This applies to overlapping
 and pop-up windows. For overlapping windows, the y parameter is used as a
 parameter for the ShowWindow function.

WS_VSCROLL

 Creates a window that has a vertical scroll bar.

Comments .. If the redefined names are used, you must include WINDOWS.H.

User-Defined Resource
~~~~~~~~~~~~~~~~~~~~~~
nameID typeID [load-mem] filename

  The filename specifies the name of a file containing the binary data of
  the resource. The contents of the file are included as the resource.
  RC does not interpret the binary data in any way. It is the programmer's
  responsibility to ensure that the data is properly aligned for the target
  machine architecture.
  A user-defined resource can also be defined completely in the resource
  script using the syntax:

nameID typeID [load-mem]
BEGIN
    raw-data
END

A user-defined resource statement specifies a resource that contains
application-specific data. The data can have any format and can be defined
either as the content of a given file (if the filename parameter is given)
or as a series of numbers and strings (if the raw-data block is given).

-- Parameters

- nameID   Specifies either a unique name or a 16-bit unsigned integer that
           identifies the resource.
- typeID   Specifies either a unique name or a 16-bit unsigned integer that
           identifies the resource type. If a number is given, it must be
           greater than 255. The numbers 1 through 255 are reserved for
           existing and future redefined resource types.
- load-mem Specifies loading and memory attributes for the resource.
           For more information, see "Common Resource Attributes".
- filename Specifies the name of the file that contains the resource data.
           The parameter must be a valid filename; it must be a full path if
           the file is not in the current working directory.
- raw-data Specifies raw data consisting of one or more integers or strings
           of characters. Integers can be specified in decimal, octal, or
           hexadecimal format. RC does not automatically append a terminating
           null character to a string. The string is a sequence of the
           specified ANSI (byte) characters unless explicitly qualified as a
           wide-character string with the L prefix. Strings in all resources
           other than RCDATA and user-defined resources are Unicode strings.
           - The block of data begins on a DWORD boundary and RC performs no
           padding or alignment of data within the raw-data block. It is the
           programmer's responsibility to ensure the proper alignment of data
           within the block.

Example .. The following example shows several user-defined statements:

array   MYRES   data.res
14      300     custom.res
18 MYRES2
BEGIN
  "Here is a data string\0", /* A string. Note: explicitly
                                null-terminated */
   1024,                     /* int        */
   0x029a,                   /* hex int    */
   0o733,                    /* octal int  */
   "\07"                     /* octal byte */
END

VERSION Statement
~~~~~~~~~~~~~~~~~
VERSION dword
The VERSION statement allows the developer to specify version information about a resource that can be used by tools that read and write resource files. The specified dword value appears with the resource in the compiled .RES file. However, the value is not stored in the executable file and has no significance to Windows.
The VERSION statement appears before the BEGIN in an ACCELERATORS, DIALOG, MENU, RCDATA, or STRINGTABLE resource definition. The specified value applies only to that resource.

Parameter

dword

A user-defined doubleword value.

See Also

Multiline Statements
CHARACTERISTICS, LANGUAGE, VERSION
ACCELERATORS, DIALOG, MENU, RCDATA, STRINGTABLE

VERSIONINFO Resource

versionID VERSIONINFO fixed-info
BEGIN
    block-statement
    . . .
END
The VERSIONINFO statement creates a version-information resource.
The resource contains such information about the file as its version number,
its intended operating system, and its original filename.
The resource is intended to be used with the File Installation library
functions.

Parameters

versionID

Specifies the version-information resource identifier. This value must be 1.

fixed-info

Specifies the version information, such as the file version and the intended operating system. This parameter consists of the following statements:

FILEVERSION version

Specifies the binary version number for the file. The version consists of two 32-bit integers, defined by four 16-bit integers. For example, FILEVERSION 3,10,0,61 is translated into two doublewords: 0x0003000a and 0x0000003d, in that order. Therefore, if version is defined by the doublewords dw1 and dw2, they need to appear in the FILEVERSION statement as follows: HIWORD(dw1), LOWORD(dw1), HIWORD(dw2), LOWORD(dw2).

PRODUCTVERSION version

Specifies the binary version number for the product with which the file is distributed. The version parameter is two 32-bit integers, defined by four 16-bit integers. For more information about version
, see the FILEVERSION description.

FILEFLAGSMASK fileflagsmask

Specifies which bits in the FILEFLAGS statement are valid. If a bit is set, the corresponding bit in FILEFLAGS is valid.

FILEFLAGS fileflags

Specifies the Boolean attributes of the file. The fileflags parameter must be the combination of all the file flags that are valid at compile time. For Windows 3.1, this value is 0x3f.

FILEOS fileos

Specifies the operating system for which this file was designed. The fileos parameter can be one of the operating system values given in the Comments section.

FILETYPE filetype

Specifies the general type of file. The filetype parameter can be one of the file type values listed in the Comments section.

FILESUBTYPE subtype

Specifies the function of the file. The subtype parameter is zero unless the type parameter in the FILETYPE statement is VFT_DRV, VFT_FONT, or VFT_VXD. For a list of file subtype values, see the Comments section.

block-statement

Specifies one or more version-information blocks. A block can contain string information or variable information.

Comments

To use the constants specified with the VERSIONINFO statement, the WINVER.H file (included in WINDOWS.H) must be included in the resource-definition file.
The following list describes the parameters used in the VERSIONINFO statement:

Parameter

fileflags

Specifies a combination of the following values:

VS_FF_DEBUG

File contains debugging information or is compiled with debugging features enabled.

VS_FF_INFOINFERRED

File contains a dynamically created version-information resource. Some of the blocks for the resource may be empty or incorrect. This value is not intended to be used in version-information resources created by using the VERSIONINFO statement.

VS_FF_PATCHED

File has been modified and is not identical to the original shipping file of the same version number.

VS_FF_PRERELEASE

File is a development version, not a commercially released product.

VS_FF_PRIVATEBUILD

File was not built using standard release procedures. If this value is given, the StringFileInfo block must contain a PrivateBuild string.

VS_FF_SPECIALBUILD

File was built by the original company using standard release procedures but is a variation of the standard file of the same version number. If this value is given, the StringFileInfo block must contain a SpecialBuild string.

fileos

Specifies one of the following values:

Value   Description
VOS_UNKNOWN Operating system for which the file was designed is unknown to Windows.
VOS_DOS File was designed for MS-DOS.
VOS_NT  File was designed for Windows NT.
VOS_WINDOWS16   File was designed for Windows version 3.0 or later.
VOS_WINDOWS32   File was designed for 32-bit Windows.
VOS_DOS_WINDOWS16   File was designed for Windows version 3.0 or later running with MS-DOS.
VOS_DOS_WINDOWS32   File was designed for 32-bit Windows running with MS-DOS.
VOS_NT_WINDOWS32    File was designed for 32-bit Windows running with Windows NT.

The values 0x00002L, 0x00003L, 0x20000L and 0x30000L are reserved.

filetype

Specifies one of the following values:

Value   Description
VFT_UNKNOWN File type is unknown to Windows.
VFT_APP File contains an application.
VFT_DLL File contains a dynamic-link library (DLL).
VFT_DRV File contains a device driver. If the dwFileType member is VFT_DRV, the dwFileSubtype member contains a more specific description of the driver.
VFT_FONT    File contains a font. If the dwFileType member is VFT_FONT, the dwFileSubtype member contains a more specific description of the font.
VFT_VXD File contains a virtual device.
VFT_STATIC_LIB  File contains a static-link library.

All other values are reserved for use by Microsoft.

subtype

Specifies additional information about the file type.
If the FILETYPE statement specifies VFT_DRV, this parameter can be one of the following values:

Value   Description
VFT2_UNKNOWN        Driver type is unknown to Windows.
VFT2_DRV_COMM       File contains a communications driver.
VFT2_DRV_PRINTER    File contains a printer driver.
VFT2_DRV_KEYBOARD   File contains a keyboard driver.
VFT2_DRV_LANGUAGE   File contains a language driver.
VFT2_DRV_DISPLAY    File contains a display driver.
VFT2_DRV_MOUSE      File contains a mouse driver.
VFT2_DRV_NETWORK    File contains a network driver.
VFT2_DRV_SYSTEM File contains a system driver.
VFT2_DRV_INSTALLABLE    File contains an installable driver.
VFT2_DRV_SOUND  File contains a sound driver.

If the FILETYPE statement specifies VFT_FONT, this parameter can be one of the following values:

Value   Description
VFT2_UNKNOWN    Font type is unknown to Windows.
VFT2_FONT_RASTER    File contains a raster font.
VFT2_FONT_VECTOR    File contains a vector font.
VFT2_FONT_TRUETYPE  File contains a TrueType font.

If the FILETYPE statement specifies VFT_VXD, this parameter must be the virtual-device identifier included in the virtual-device control block.
All subtype values not listed here are reserved for use by Microsoft.

langID

Specifies one of the following language codes:

Code    Language    Code    Language
0x0401  Arabic      0x0417  Rhaeto-Romanic
0x0402  Bulgarian   0x0418  Romanian
0x0403  Catalan     0x0419  Russian
0x0404  Traditional Chinese 0x041A  Croato-Serbian (Latin)
0x0405  Czech       0x041B  Slovak
0x0406  Danish      0x041C  Albanian
0x0407  German      0x041D  Swedish
0x0408  Greek       0x041E  Thai
0x0409  U.S. English    0x041F  Turkish
0x040A  Castilian Spanish   0x0420  Urdu
0x040B  Finnish     0x0421  Bahasa
0x040C  French      0x0804  Simplified Chinese
0x040D  Hebrew      0x0807  Swiss German
0x040E  Hungarian   0x0809  U.K. English
0x040F  Icelandic   0x080A  Mexican Spanish
0x0410  Italian     0x080C  Belgian French
0x0411  Japanese    0x0810  Swiss Italian
0x0412  Korean      0x0813  Belgian Dutch
0x0413  Dutch       0x0814  Norwegian - Nynorsk
0x0414  Norwegian - Bokml   0x0816  Portuguese
0x0415  Polish      0x081A  Serbo-Croatian (Cyrillic)
0x0416  Brazilian Portuguese    0x0C0C  Canadian French
0x0417  Rhaeto-Romanic  0x100C  Swiss French

charsetID

Specifies one of the following character-set identifiers:

Identifier  Character Set
0   7-bit ASCII
932 Windows, Japan (Shift - JIS X-0208)
949 Windows, Korea (Shift - KSC 5601)
950 Windows, Taiwan (GB5)
1200    Unicode
1250    Windows, Latin-2 (Eastern European)
1251    Windows, Cyrillic
1252    Windows, Multilingual
1253    Windows, Greek
1254    Windows, Turkish
1255    Windows, Hebrew
1256    Windows, Arabic

string-name

Specifies one of the following redefined names:

Comments

Specifies additional information that should be displayed for diagnostic purposes.

CompanyName

Specifies the company that produced the file¾for example, "Microsoft Corporation" or "Standard Microsystems Corporation, Inc.". This string is required.

FileDescription

Specifies a file description to be presented to users. This string may be displayed in a list box when the user is choosing files to install¾for example, "Keyboard Driver for AT-Style Keyboards" or "Microsoft Word for Windows". This string is required.

FileVersion

Specifies the version number of the file¾for example, "3.10" or "5.00.RC2". This string is required.

InternalName

Specifies the internal name of the file, if one exists¾for example, a module name if the file is a dynamic-link library. If the file has no internal name, this string should be the original filename, without extension. This string is required.

LegalCopyright

Specifies all copyright notices that apply to the file. This should include the full text of all notices, legal symbols, copyright dates, and so on¾for example, "Copyright© Microsoft Corporation 1990-1992". This string is optional.

LegalTrademarks

Specifies all trademarks and registered trademarks that apply to the file. This should include the full text of all notices, legal symbols, trademark numbers, and so on¾for example, "Windows™ is a trademark of Microsoft® Corporation". This string is optional.

OriginalFilename

Specifies the original name of the file, not including a path. This information enables an application to determine whether a file has been renamed by a user. The format of the name depends on the file system for which the file was created. This string is required.

PrivateBuild

Specifies information about a private version of the file¾for example, "Built by TESTER1 on \TESTBED". This string should be present only if the VS_FF_PRIVATEBUILD flag is set in the dwFileFlags member of the VS_FIXEDFILEINFO structure of the root block.

ProductName

Specifies the name of the product with which the file is distributed¾for example, "Microsoft Windows". This string is required.

ProductVersion

Specifies the version of the product with which the file is distributed¾for example, "3.10" or "5.00.RC2". This string is required.

SpecialBuild

Specifies how this version of the file differs from the standard version¾for example, "Private build for TESTER1 solving mouse problems on M250 and M250E computers". This string should be present only if the VS_FF_SPECIALBUILD flag is set in the dwFileFlags member of the VS_FIXEDFILEINFO structure in the root block.

A string information block has the following form:
BLOCK "StringFileInfo"
BEGIN
    BLOCK "lang-charset"
    BEGIN
        VALUE "string-name", "value"
            . . .
    END
END
Following are the parameters in the StringFileInfo block:

lang-charset

Specifies a language and character-set identifier pair. It is a hexadecimal string consisting of the concatenation of the language and character-set identifiers listed earlier in this section.

string-name

Specifies the name of a value in the block and can be one of the redefined names listed earlier in this section.

value

Specifies, as a character string, the value of the corresponding string name. More than one VALUE statement can be given.

A variable information block has the following form:
BLOCK "VarFileInfo"
BEGIN
    VALUE "Translation",
        langID, charsetID
            . . .
END
Following are the parameters in the variable information block:

langID

Specifies one of the language identifiers listed earlier in this section.

charsetID

Specifies one of the character-set identifiers listed earlier in this section. More than one identifier pair can be given, but each pair must be separated from the preceding pair with a comma.

----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------

Preprocessing Reference

- The syntax and semantics for the RC preprocessor is the same as for the
 preprocessor in a C compiler. Single-line comments begin with two forward
 slashes (//) and run to the end of the line.
 Block comments begin with an opening delimiter (/*) and run to a closing
 delimiter (*/). Comments do not nest.

- You use the #define directive to define symbols for your resource
 identifiers in a header file. You include this header both in the resource
 script and your application source code.
 Similarly, the values for attributes and styles are defined by including
 the C header files for Windows.

- You can also define macros.
 The standard C preprocessing operators (#, ##) can be used in a macro
 definition. For detailed information on preprocessing and defining macros,
 see your C compiler documentation.

Directive   Description
#define   Defines a specified name by assigning it a given value.
#elif     Marks an optional clause of a conditional-compilation block.
#else     Marks the last optional clause of a conditional-compilation block.
#endif    Marks the end of a conditional-compilation block.
#if       Conditionally compiles the script if a specified expression is true.
#ifdef    Conditionally compiles the script if a specified name is defined.
#ifndef   Conditionally compiles the script if a specified name is not defined.
#include  Copies the contents of a file into the resource-definition file.
#undef    Removes the definition of the specified name.

#define
~~~~~~~
 #define name value

 The #define directive assigns the given value to the specified name.
 All subsequent occurrences of the name are replaced by the value.

 - Parameters

 name   Specifies the name to be defined. This value is any combination of
        letters, digits, and punctuation.

 value  Specifies any integer, character string, or line of text.

Example  This example assigns values to the names "NONZERO" and "USERCLASS":

#define     NONZERO     1
#define     USERCLASS   "MyControlClass"
#define     path1       "C:\MASM32\BIN"      // Jmm

See Also    #ifdef, #ifndef, #undef

#elif
~~~~~
#elif constant-expression
The #elif directive marks an optional clause of a conditional-compilation
block defined by a #ifdef, #ifndef, or #if directive.
The directive controls conditional compilation of the resource file by
checking the specified constant expression. If the constant expression is
nonzero, #elif directs the compiler to continue processing statements up to
the next #endif, #else, or #elif directive and then skip to the statement
after #endif. If the constant expression is zero, #elif directs the compiler
to skip to the next #endif, #else, or #elif directive. You can use any number
of #elif directives in a conditional block.

- Parameter  constant-expression

Specifies the expression to be checked. This value is a defined name, an i
nteger constant, or an expression consisting of names, integers, and
arithmetic and relational operators.

Example
In this example, #elif directs the compiler to process the second BITMAP
statement only if the value assigned to the name "Version" is less than 7.
The #elif directive itself is processed only if Version is greater than or
equal to 3.

#if Version < 3
BITMAP 1 errbox.bmp
#elif Version < 7
BITMAP 1 userbox.bmp
#endif

#else
~~~~~~
The #else directive marks an optional clause of a conditional-compilation
block defined by a #ifdef, #ifndef, or #if directive. The #else directive
must be the last directive before the #endif directive.
This directive has no arguments.

Example ..
This example compiles the second BITMAP statement only if the name "DEBUG"
is not defined:

#ifdef DEBUG
    BITMAP 1 errbox.bmp
#else
    BITMAP 1 userbox.bmp
#endif

#endif
~~~~~~
The #endif directive marks the end of a conditional-compilation block defined
by a #ifdef directive.
One #endif is required for each #if, #ifdef, or #ifndef directive.
This directive has no arguments.

#if
~~~~
#if constant-expression
The #if directive controls conditional compilation of the resource file by
checking the specified constant expression. If the constant expression is
nonzero, #if directs the compiler to continue processing statements up to
the next #endif, #else, or #elif directive and then skip to the statement
after the #endif directive. If the constant expression is zero, #if directs
the compiler to skip to the next #endif, #else, or #elif directive.

Parameter  constant-expression

Specifies the expression to be checked. This value is a defined name, an
integer constant, or an expression consisting of names, integers, and
arithmetic and relational operators.

Example
This example compiles the BITMAP statement only if the value assigned to the
name "Version" is less than 3:

#if Version < 3
BITMAP 1 errbox.bmp
#endif

#ifdef
~~~~~~~~
#ifdef name

The #ifdef directive controls conditional compilation of the resource file
by checking the specified name. If the name has been defined by using a
#define directive or by using the -d command-line option with the Resource
Compiler, #ifdef directs the compiler to continue with the statement
immediately after the #ifdef directive. If the name has not been defined,
#ifdef directs the compiler to skip all statements up to the next #endif directive.

- Parameter
  name     Specifies the name to be checked by the directive.

- Example
This example compiles the BITMAP statement only if the name "Debug" is defined:

#ifdef Debug
BITMAP 1 errbox.bmp
#endif

#ifndef
~~~~~~~~
#ifndef name

The #ifndef directive controls conditional compilation of the resource file
by checking the specified name. If the name has not been defined or if its
definition has been removed by using the #undef directive, #ifndef directs
the compiler to continue processing statements up to the next #endif, #else,
or #elif directive and then skip to the statement after the #endif directive.
If the name is defined, #ifndef directs the compiler to skip to the next
#endif, #else, or #elif directive.

-Parameter
 name      Specifies the name to be checked by the directive.

- Example
This example compiles the BITMAP statement only if the name "Optimize" is
not defined:

#ifndef Optimize
BITMAP 1 errbox.bmp
#endif

#include
~~~~~~~~
#include (filename)

The #include directive causes Resource Compiler to process the file specified
in the filename parameter. This file should be a header file that defines the
constants used in the resource-definition file.

- Parameter
  filename  Specifies the name of the file to be included.
  If the file is in the current directory, the string must be enclosed in
  double quotation marks; if the file is in the directory specified by the
  INCLUDE environment variable, the string must be enclosed in less-than and
  greater-than characters (<>). You must give a full path enclosed in double
  quotation marks if the file is not in the current directory or in the
  directory specified by the INCLUDE environment variable.

- Example
  This example processes the header files WINDOWS.H and HEADERS\MYDEFS.H
  while compiling the resource-definition file:

  #include
  #include "headers\mydefs.h"

#undef
~~~~~~
#undef name
The #undef directive removes the current definition of the specified name.
All subsequent occurrences of the name are processed without replacement.

- Parameter
  name     Specifies the name to be removed.
  This value is any combination of letters, digits, and punctuation.

- Example
This example removes the definitions for the names "nonzero" and "USERCLASS":

  #undef     nonzero
  #undef     USERCLASS


Preprocessing Reference

- The syntax and semantics for the RC preprocessor is the same as for the
 preprocessor in a C compiler. Single-line comments begin with two forward
 slashes (//) and run to the end of the line.
 Block comments begin with an opening delimiter (/*) and run to a closing
 delimiter (*/). Comments do not nest.

- You use the #define directive to define symbols for your resource
 identifiers in a header file. You include this header both in the resource
 script and your application source code.
 Similarly, the values for attributes and styles are defined by including
 the C header files for Windows.

- You can also define macros.
 The standard C preprocessing operators (#, ##) can be used in a macro
 definition. For detailed information on preprocessing and defining macros,
 see your C compiler documentation.

Directive   Description
#define   Defines a specified name by assigning it a given value.
#elif     Marks an optional clause of a conditional-compilation block.
#else     Marks the last optional clause of a conditional-compilation block.
#endif    Marks the end of a conditional-compilation block.
#if       Conditionally compiles the script if a specified expression is true.
#ifdef    Conditionally compiles the script if a specified name is defined.
#ifndef   Conditionally compiles the script if a specified name is not defined.
#include  Copies the contents of a file into the resource-definition file.
#undef    Removes the definition of the specified name.

#define
~~~~~~~
 #define name value

 The #define directive assigns the given value to the specified name.
 All subsequent occurrences of the name are replaced by the value.

 - Parameters

 name   Specifies the name to be defined. This value is any combination of
        letters, digits, and punctuation.

 value  Specifies any integer, character string, or line of text.

Example  This example assigns values to the names "NONZERO" and "USERCLASS":

#define     NONZERO     1
#define     USERCLASS   "MyControlClass"
#define     path1       "C:\MASM32\BIN"      // Jmm

See Also    #ifdef, #ifndef, #undef

#elif
~~~~~
#elif constant-expression
The #elif directive marks an optional clause of a conditional-compilation
block defined by a #ifdef, #ifndef, or #if directive.
The directive controls conditional compilation of the resource file by
checking the specified constant expression. If the constant expression is
nonzero, #elif directs the compiler to continue processing statements up to
the next #endif, #else, or #elif directive and then skip to the statement
after #endif. If the constant expression is zero, #elif directs the compiler
to skip to the next #endif, #else, or #elif directive. You can use any number
of #elif directives in a conditional block.

- Parameter  constant-expression

Specifies the expression to be checked. This value is a defined name, an i
nteger constant, or an expression consisting of names, integers, and
arithmetic and relational operators.

Example
In this example, #elif directs the compiler to process the second BITMAP
statement only if the value assigned to the name "Version" is less than 7.
The #elif directive itself is processed only if Version is greater than or
equal to 3.

#if Version < 3
BITMAP 1 errbox.bmp
#elif Version < 7
BITMAP 1 userbox.bmp
#endif

#else
~~~~~~
The #else directive marks an optional clause of a conditional-compilation
block defined by a #ifdef, #ifndef, or #if directive. The #else directive
must be the last directive before the #endif directive.
This directive has no arguments.

Example ..
This example compiles the second BITMAP statement only if the name "DEBUG"
is not defined:

#ifdef DEBUG
    BITMAP 1 errbox.bmp
#else
    BITMAP 1 userbox.bmp
#endif

#endif
~~~~~~
The #endif directive marks the end of a conditional-compilation block defined
by a #ifdef directive.
One #endif is required for each #if, #ifdef, or #ifndef directive.
This directive has no arguments.

#if
~~~~
#if constant-expression
The #if directive controls conditional compilation of the resource file by
checking the specified constant expression. If the constant expression is
nonzero, #if directs the compiler to continue processing statements up to
the next #endif, #else, or #elif directive and then skip to the statement
after the #endif directive. If the constant expression is zero, #if directs
the compiler to skip to the next #endif, #else, or #elif directive.

Parameter  constant-expression

Specifies the expression to be checked. This value is a defined name, an
integer constant, or an expression consisting of names, integers, and
arithmetic and relational operators.

Example
This example compiles the BITMAP statement only if the value assigned to the
name "Version" is less than 3:

#if Version < 3
BITMAP 1 errbox.bmp
#endif

#ifdef
~~~~~~~~
#ifdef name

The #ifdef directive controls conditional compilation of the resource file
by checking the specified name. If the name has been defined by using a
#define directive or by using the -d command-line option with the Resource
Compiler, #ifdef directs the compiler to continue with the statement
immediately after the #ifdef directive. If the name has not been defined,
#ifdef directs the compiler to skip all statements up to the next #endif directive.

- Parameter
  name     Specifies the name to be checked by the directive.

- Example
This example compiles the BITMAP statement only if the name "Debug" is defined:

#ifdef Debug
BITMAP 1 errbox.bmp
#endif

#ifndef
~~~~~~~~
#ifndef name

The #ifndef directive controls conditional compilation of the resource file
by checking the specified name. If the name has not been defined or if its
definition has been removed by using the #undef directive, #ifndef directs
the compiler to continue processing statements up to the next #endif, #else,
or #elif directive and then skip to the statement after the #endif directive.
If the name is defined, #ifndef directs the compiler to skip to the next
#endif, #else, or #elif directive.

-Parameter
 name      Specifies the name to be checked by the directive.

- Example
This example compiles the BITMAP statement only if the name "Optimize" is
not defined:

#ifndef Optimize
BITMAP 1 errbox.bmp
#endif

#include
~~~~~~~~
#include (filename)

The #include directive causes Resource Compiler to process the file specified
in the filename parameter. This file should be a header file that defines the
constants used in the resource-definition file.

- Parameter
  filename  Specifies the name of the file to be included.
  If the file is in the current directory, the string must be enclosed in
  double quotation marks; if the file is in the directory specified by the
  INCLUDE environment variable, the string must be enclosed in less-than and
  greater-than characters (<>). You must give a full path enclosed in double
  quotation marks if the file is not in the current directory or in the
  directory specified by the INCLUDE environment variable.

- Example
  This example processes the header files WINDOWS.H and HEADERS\MYDEFS.H
  while compiling the resource-definition file:

  #include
  #include "headers\mydefs.h"

#undef
~~~~~~
#undef name
The #undef directive removes the current definition of the specified name.
All subsequent occurrences of the name are processed without replacement.

- Parameter
  name     Specifies the name to be removed.
  This value is any combination of letters, digits, and punctuation.

- Example
This example removes the definitions for the names "nonzero" and "USERCLASS":

  #undef     nonzero
  #undef     USERCLASS


RC Diagnostic Messages

The Help topics available under the alphabetic buttons at the top of the Help
 window contain descriptions of diagnostic messages produced by Microsoft
 Resource Compiler (RC) for Windows NT. Many of these messages appear when
 RC is not able to compile resources properly. The descriptions clarify the
 cause of each message.
A capital V in parentheses (V) at the beginning of a message description
 indicates that the message is displayed only  if RC is run with the /V
 (verbose) option.  These messages are generally  informative and do not
 necessarily indicate errors.

RC Diagnostic Messages          - A -

Accelerator Type required (ASCII or VIRTKEY)

The type parameter in the ACCELERATORS statement must contain either the
ASCII or VIRTKEY value.

RC Diagnostic Messages         - B -

BEGIN expected in Accelerator Table

An ACCELERATORS statement was not followed by the BEGIN keyword.

BEGIN expected in Dialog

A DIALOG statement was not followed by the BEGIN keyword.

BEGIN expected in menu

A MENU statement was not followed by the BEGIN keyword.

BEGIN expected in RCData

An RCDATA statement was not followed by the BEGIN keyword.

BEGIN expected in String Table

A STRINGTABLE statement was not followed by the BEGIN keyword.

BEGIN expected in VERSIONINFO resource

A VERSIONINFO statement was not followed by the BEGIN keyword.

Bitmap file resource-file is not in version-number format.

Use Microsoft Image Editor (IMAGEDIT.EXE) to convert old resource files to the current format.

RC Diagnostic Messages         - C -

Cannot Re-use String Constants

You are using the same value twice in a STRINGTABLE statement. Make sure that you have not mixed overlapping decimal and hexadecimal values.

Control Character out of range [A - Z]

A control character in the ACCELERATORS statement is invalid. The character following the caret (^) must be in the range A through Z.

Could not open in-file-name

Microsoft Windows Resource Compiler (RC) could not open the specified file. Make sure that the file exists and that you typed the filename correctly.

Couldn't open resource-name

Microsoft Windows Resource Compiler (RC) could not open the specified file. Make sure that the file exists and that you typed the filename correctly.

Creating resource-name

(V) Microsoft Windows Resource Compiler (RC) is creating a new binary resource (.RES) file.

RC Diagnostic Messages         - E -

Empty menus not allowed

An END keyword appears before any menu items are defined in the MENU statement. Empty menus are not permitted by Microsoft Windows Resource Compiler (RC). Make sure that you do not have any opening quotation marks within the MENU statement.

END expected in Dialog

The END keyword must appear at the end of a DIALOG statement. Make sure that there are no opening quotation marks left from the preceding statement.

END expected in menu

The END keyword must appear at the end of a MENU statement. Make sure that there are no mismatched BEGIN and END statements.

Error Creating resource-name

Microsoft Windows Resource Compiler (RC) could not create the specified binary resource (.RES) file. Make sure that it is not being created on a read-only drive. Use the -V option to find out whether the file is being created.

Expected Comma in Accelerator Table

Microsoft Windows Resource Compiler (RC) requires a comma between the event and idvalue parameters in the ACCELERATORS statement.

Expected control class name

The class parameter of a CONTROL statement in the DIALOG statement must be one of the following control types: BUTTON, COMBOBOX, EDIT, LISTBOX, SCROLLBAR, STATIC, or user-defined. Make sure that the class is spelled correctly.

Expected font face name

The typeface parameter of the FONT statement in the DIALOG statement must be a character string enclosed in double quotation marks. This parameter specifies the name of a font.

Expected ID value for Menuitem

The MENU statement must contain a MENUITEM statement, which has either an integer or a symbolic constant in the MenuID parameter.

Expected Menu String

Each MENUITEM and POPUP statement must contain a text parameter. This parameter is a string enclosed in double quotation marks that specifies the name of the menu item or pop-up menu. A MENUITEM SEPARATOR statement requires no quoted string.

Expected numeric command value

Microsoft Windows Resource Compiler (RC) was expecting a numeric idvalue parameter in the ACCELERATORS statement. Make sure that you have used a #define constant to specify the value and that the constant used is spelled correctly.

Expected numeric constant in string table

A numeric constant, defined in a #define statement, must immediately follow the BEGIN keyword in a STRINGTABLE statement.

Expected numeric point size

The pointsize parameter of the FONT statement in the DIALOG statement must be an integer point-size value.

Expected Numerical Dialog constant

A DIALOG statement requires integer values for the x, y, width, and height parameters. Make sure that these values, which are included after the DIALOG keyword, are not negative.

Expected String in STRINGTABLE

A string is expected after each numeric stringid parameter in a STRINGTABLE statement.

Expected String or Constant Accelerator command

Microsoft Windows Resource Compiler (RC) was not able to determine which key was being set up for the accelerator. The event parameter in the ACCELERATORS statement might be invalid.

Expected VALUE, BLOCK, or END keyword.

The VERSIONINFO structure requires a VALUE, BLOCK, or END keyword.

Expecting number for ID

A number is expected for the id parameter of a CONTROL statement in the DIALOG statement. Make sure that you have a number or a #define statement for the control identifier.

Expecting quoted string for key

The key string following the BLOCK or VALUE keyword should be enclosed in double quotation marks.

Expecting quoted string in dialog class

The class parameter of the CLASS statement in the DIALOG statement must be an integer or a string enclosed in double quotation marks.

Expecting quoted string in dialog title

The captiontext parameter of the CAPTION statement in the DIALOG statement must be a character string, enclosed in double quotation marks.

RC Diagnostic Messages         - F -

File not found: filename

The file specified in the rc command was not found. Make sure that the file has not been moved to another directory and that the filename or path is typed correctly.

Font names must be ordinals

The pointsize parameter in the FONT statement must be an integer, not a string.

RC Diagnostic Messages         - I -

Invalid Accelerator

An event parameter in the ACCELERATORS statement was not recognized or was more than two characters long.

Invalid Accelerator Type (ASCII or VIRTKEY)

The type parameter in the ACCELERATORS statement must contain either the ASCII or VIRTKEY value.

Invalid control character

A control character in the ACCELERATORS statement is invalid. A valid control character consists of a caret (^) followed by a single letter.

Invalid Control type

The CONTROL statement in a DIALOG statement must be one of the following:  AUTO3STATE, AUTOCHECKBOX, AUTORADIOBUTTON, CHECKBOX, COMBOBOX, CONTROL, CTEXT, DEFPUSHBUTTON, EDITTEXT, GROUPBOX, ICON, LISTBOX, LTEXT, PUSHBOX, PUSHBUTTON, RADIOBUTTON, RTEXT, SCROLLBAR, STATE3.

Invalid directive in preprocessed RC file

The specified filename has an embedded newline character.

Invalid .EXE file

The executable (.EXE) file is invalid. Make sure that the linker created it correctly and that the file exists.

Invalid switch, option

An option used was invalid. For a list of the command-line options, use the RC /? command.

Invalid switch, too many -D switches

Too many /D options were specified. To define a large number of symbols, use the #include directive to include a file of definitions.

Invalid type

The resource type was not among the types defined in the include file.

Invalid usage. Use RC -? for Help

Make sure that you have at least one filename to work with. For a list of the command-line options, use the RC /? command.

I/O error reading file.

Read failed. Since this is a generic routine, no specific filename is supplied.

I/O error seeking in file

Seeking in file failed. Since this is a generic routine, no specific filename is supplied.

I/O error writing file.

Write failed. Since this is a generic routine, no specific filename is supplied.

RC Diagnostic Messages         - N -

No resource binary filename specified.

The /FO option was used, but no binary resource (.RES) file was specified.

RC Diagnostic Messages         - O -

Old DIB in resource-name. Pass it through IMAGEDIT.

The resource file specified is not compatible with Win32. Make sure you have read and saved this file using the latest version of Microsoft Image Editor (IMAGEDIT.EXE).

Out of heap memory

There was not enough memory.

Out of memory, needed n bytes

Microsoft Windows Resource Compiler (RC) was not able to allocate the specified amount of memory.

RC Diagnostic Messages         - R -

Redefinition of Button Type

The specified button styles conflict with or modify the style specified by the control keyword. This is a warning only and may be ignored.
The following common method of declaring an automatic radio button generates this warning:

RADIOBUTTON "&Italic", MYRB_ITALIC, 10, 10, 30, 12, BS_AUTORADIOBUTTON

To avoid the warning, use the control statement appropriate for the type of button that you want to define. In this example, the corrected statement is:

AUTORADIOBUTTON "&Italic", MYRB_ITALIC, 10, 10, 30, 12

RC: Invalid switch: option

An option used was invalid. For a list of the command-line options, use the RC /? command.

RC terminated by user

A CTRL+C key combination was pressed, exiting Microsoft Windows Resource Compiler (RC).

RC terminating after preprocessor errors

For information about preprocessor errors, see the documentation for the preprocessor.

Resource file resource-name is not in version-number format.

Make sure your icons and cursors have been read and saved using the latest version of Microsoft Image Editor (IMAGEDIT.EXE).

RC Diagnostic Messages         - T -

Text string or ordinal expected in Control

The text parameter of a CONTROL statement in the DIALOG statement must be either a text string or an ordinal reference to the type of control that is expected. If using an ordinal, make sure that you have a #define statement for the control.

RC Diagnostic Messages         - U -

Unable to create destination

Microsoft Windows Resource Compiler (RC) was not able to create the destination file. Make sure that there is enough disk space.

Unbalanced Parentheses

Make sure that you have closed every opening parenthesis in the DIALOG statement.

Unexpected value in RCData

The values for the raw-data parameter in the RCDATA statement must be integers or strings, separated by commas. Make sure that you did not leave out a comma or a quotation mark around a string.

Unexpected value in value data

A statement contained information with a format or size different from the expected value for that parameter.

Unknown DIB header format

The device-independent bitmap (DIB) header is not a BITMAPCOREHEADER or BITMAPINFOHEADER structure.

Unknown Menu SubType

The item-definitions parameter of the MENU statement can contain only MENUITEM and POPUP statements.

Unrecognized VERSIONINFO field; BEGIN or comma expected

The format of the information following a VERSIONINFO statement is incorrect.

RC Diagnostic Messages         - V -

Version WORDs separated by commas expected

Values in an information block for a VERSIONINFO statement should be separated by commas.

RC Diagnostic Messages         - W -

Warning: ASCII character not equivalent to virtual key code

An invalid virtual-key code exists in the ACCELERATORS statement. The ASCII values for some characters such as *, ^, or & are not equivalent to the virtual-key codes for the corresponding keys. In the case of the asterisk [*], the virtual-key code is equivalent to the ASCII value for 8, the numeric character on the same key. Therefore, the statement VIRTKEY '* ' is invalid.

Warning: SHIFT or CONTROL used without VIRTKEY

The ALT, SHIFT, and CONTROL options apply only to virtual keys in the ACCELERATORS statement. Make sure that the VIRTKEY option is used with one of these other options.

Writing resource type image lang:language size:size

(V) Microsoft Windows Resource Compiler (RC) is writing the specified resource. The type is the resource type. It may be a number or a string. The image can be a number or a string. The language is the national language of the resource. The size is the decimal size of the resource in bytes.


Resource-Definition Statements

The resource-definition statements define the resources that the resource compiler puts in the resource (.RES) file. After the .RES file is linked to the executable file, the application can load its resources at run time as needed. All resource statements associate an identifying name or number with a given resource.

The resource-definition statements can be divided into the following categories:

  • Resources
  • Controls
  • Statements

The following tables describe the resource-definition statements.

Resources

ACCELERATORS | Defines menu accelerator keys.
BITMAP | Defines a bitmap by naming it and specifying the name of the file that contains it. (To use a particular bitmap, the application requests it by name.)
CURSOR | Defines a cursor or animated cursor by naming it and specifying the name of the file that contains it. (To use a particular cursor, the application requests it by name.)
DIALOG | Defines a template that an application can use to create dialog boxes.
DIALOGEX | Defines a template that an application can use to create dialog boxes.
FONT | Specifies the name of a file that contains a font.
ICON | Defines an icon or animated icon by naming it and specifying the name of the file that contains it. (To use a particular icon, the application requests it by name.)
MENU | Defines the appearance and function of a menu.
MENUEX | Defines the appearance and function of a menu.
MESSAGETABLE | Defines a message table by naming it and specifying the name of the file that contains it. The file is a binary resource file generated by the Message Compiler.
POPUP | Defines a menu item that can contain menu items and submenus.
RCDATA | Defines data resources. Data resources let you include binary data in the executable file.
STRINGTABLE | Defines string resources. String resources are Unicode strings that can be loaded from the executable file.
User-Defined | Defines a resource that contains application-specific data.
VERSIONINFO | Defines a version-information resource. Contains information such as the version number, intended operating system, and so on.

Controls

AUTO3STATE | Creates an automatic three-state check box control.
AUTOCHECKBOX | Creates an automatic check box control.
AUTORADIOBUTTON | Creates an automatic radio button control.
CHECKBOX | Creates a check box control.
COMBOBOX | Creates a combo box control.
CONTROL | Creates an application-defined control.
CTEXT | Creates a centered-text control.
DEFPUSHBUTTON | Creates a default pushbutton control.
EDITTEXT | Creates an edit control.
GROUPBOX | Creates a group box control.
ICON | Creates an icon control. This control is an icon displayed in a dialog box.
LISTBOX | Creates a list box control.
LTEXT | Creates a left-aligned text control.
PUSHBOX | Creates a push box control.
PUSHBUTTON | Creates a push button control.
RADIOBUTTON | Creates a radio button control.
RTEXT | Creates a right-aligned control.
SCROLLBAR | Creates a scroll bar control.
STATE3 | Creates a three-state check box control.

Statements

CAPTION | Sets the title for a dialog box.
CHARACTERISTICS | Specifies information about a resource that can be used by tool that can read or write resource-definition files.
CLASS | Sets the class of the dialog box.
EXSTYLE | Sets the extended window style of the dialog box.
FONT | Sets the font with which the system will draw text for the dialog box.
LANGUAGE | Sets the language for all resources up to the next LANGUAGE statement or to the end of the file. When the LANGUAGE statement appears before the beginning of the body of an ACCELERATORS, DIALOG, MENU, RCDATA, or STRINGTABLE resource definition, the specified language applies only to that resource.
MENU | Sets the menu for the dialog box.
MENUITEM | Defines a menu item.
STYLE | Sets the window style for the dialog box.
VERSION | Specifies version information for a resource that can be used by tool that can read or write resource-definition files.


Comments

RC supports C-style syntax for both single-line comments and block comments. Single-line comments begin with two forward slashes (//) and run to the end of the line. The following is an example of a resource statement followed by a single-line comment.

NewCursor  CURSOR  NEW.CUR  // a new cursor for the application.

Block comments begin with an opening delimiter (/*) and run to a closing delimiter (*/). Comments do not nest. The following is an example of a block comment at the beginning of a RC file.

/*
    Resources.Rc

    Contains the resource definitions for the application.
    Control identifiers are defined in Resources.H.
*/

#include "resources.h"
…


Common Resource Attributes

The resource-definition statements supported on 16-bit Windows include a load-mem option that specifies the loading and memory characteristics of the resource. The resource statements supported on 32-bit Windows do not use any of these attributes. However, the attributes are permitted in resource scripts for backward compatibility. Win32 resources are loaded when the corresponding module is loaded, and are freed when the module is unloaded. These attributes are ignored.

These attributes are divided into two groups: load attributes and memory attributes.

Load Attributes

The load attributes specify when the resource is to be loaded. The load parameter must be one of the following:

Attribute | Description
PRELOAD | Ignored. In 16-bit Windows, the resource is loaded with the executable file.
LOADONCALL | Ignored. In 16-bit Windows, the resource is loaded when called.

Memory Attributes

The memory attributes specify whether the resource is fixed or movable, whether it is discardable, and whether it is pure. The memory parameter can be one or more of the following:

Attribute | Description
FIXED | Ignored. In 16-bit Windows, the resource remains at a fixed memory location.
MOVEABLE | Ignored. In 16-bit Windows, the resource can be moved if necessary to compact memory.
DISCARDABLE | Ignored. In 16-bit Windows, the resource can be discarded if no longer needed.
PURE | Ignored. Accepted for compatibility with existing resource scripts.
IMPURE | Ignored. Accepted for compatibility with existing resource scripts.


Creating a Resource-Definition File

After creating individual resource files for your application's icon, cursor, font, bitmap, and dialog boxes, create a resource-definition file, or script. A script file is a text file with the extension .RC. The file can use single-byte, double-byte, or Unicode characters.

The syntax and semantics for the RC preprocessor are similar to those of the Microsoft C/C++ compiler. However, RC supports a subset of the preprocessor directives, defines, and pragmas in a script.

The script also defines resources. For a resource that exists in a separate file, such as an icon or cursor, the script specifies the resource and the file that contains it. For some resources, such as a menu, the entire definition of the resource exists within the script.

The following topics describe the information a script file can contain:

  • Comments, which are notes to be ignored by RC.
  • Predefined macros, which take no arguments and cannot be redefined.
  • Preprocessor directives, which instruct RC to perform actions on the script before compiling it.
  • Preprocessor operators, which are used with the #define directive.
  • Pragma directives
  • Resource-definition statements, which name and describe resources.


Sample Resource-Definition File

The following example shows a script file that defines the resources for an application named Shapes:

#include "shapes.h"

ShapesCursor  CURSOR  SHAPES.CUR
ShapesIcon    ICON    SHAPES.ICO

ShapesMenu MENU
{
    POPUP "&Shape"
    {
        MENUITEM "&Clear", ID_CLEAR
        MENUITEM "&Rectangle", ID_RECT
        MENUITEM "&Triangle", ID_TRIANGLE
        MENUITEM "&Star", ID_STAR
        MENUITEM "&Ellipse", ID_ELLIPSE
    }
}

The CURSOR statement names the application's cursor resource ShapesCursor and specifies the cursor file SHAPES.CUR, which contains the image for that cursor.

The ICON statement names the application's icon resource ShapesIcon and specifies the icon file SHAPES.ICO, which contains the image for that icon.

The MENU statement defines an application menu named ShapesMenu, a pop-up menu with five menu items.

The body of the menu definition, enclosed by the curly braces, or the BEGIN and END keywords, specifies each menu item and the menu identifier that is returned when the user selects that item. For example, the first item on the menu, Clear, returns the menu identifier ID_CLEAR when the user selects it. The menu identifiers are defined in the application header file, SHAPES.H.


Resources

ACCELERATORS | Defines menu accelerator keys.
BITMAP | Defines a bitmap by naming it and specifying the name of the file that contains it. (To use a particular bitmap, the application requests it by name.)
CURSOR | Defines a cursor or animated cursor by naming it and specifying the name of the file that contains it. (To use a particular cursor, the application requests it by name.)
DIALOG | Defines a template that an application can use to create dialog boxes.
DIALOGEX | Defines a template that an application can use to create dialog boxes.
FONT | Specifies the name of a file that contains a font.
ICON | Defines an icon or animated icon by naming it and specifying the name of the file that contains it. (To use a particular icon, the application requests it by name.)
MENU | Defines the appearance and function of a menu.
MENUEX | Defines the appearance and function of a menu.
MESSAGETABLE | Defines a message table by naming it and specifying the name of the file that contains it. The file is a binary resource file generated by the Message Compiler.
POPUP | Defines a menu item that can contain menu items and submenus.
RCDATA | Defines data resources. Data resources let you include binary data in the executable file.
STRINGTABLE | Defines string resources. String resources are Unicode strings that can be loaded from the executable file.
User-Defined | Defines a resource that contains application-specific data.
VERSIONINFO | Defines a version-information resource. Contains information such as the version number, intended operating system, and so on.


ACCELERATORS Resource

The ACCELERATORS resource-definition statement specifies one or more accelerators for an application. An accelerator is a keystroke defined by the application to give the user a quick way to perform a task.

The TranslateAccelerator function is used to translate accelerator messages from the application queue into WM_COMMAND or WM_SYSCOMMAND messages.

Syntax

acctablename ACCELERATORS  [optional-statements]  {      event, idvalue, [type] [options]      . . .  }

Parameters

acctablename
Specifies either a unique name or a 16-bit unsigned integer value that identifies the resource.
optional-statements
Zero or more of the following statements:
Statement | Description
CHARACTERISTICS dword | User-defined information about a resource that can be used by tools that read and write resource files.
LANGUAGE language, sublanguage | Specifies the language for the resource. The parameters are constants from WINNT.H.
VERSION dword | User-defined version number for the resource that can be used by tools that read and write resource files.

event
Specifies the keystroke to be used as an accelerator. It can be any one of the following character types:
Type | Description
"char" | A single character enclosed in double quotation marks ("). The character can be preceded by a caret (^), meaning that the character is a control character.
Character | An integer value representing a character. The type parameter must be ASCII.
virtual-key character | An integer value representing a virtual key. The virtual key for alphanumeric keys can be specified by placing the uppercase letter or number in double quotation marks (for example, "9" or "C"). The type parameter must be VIRTKEY.

idvalue
Specifies a 16-bit unsigned integer value that identifies the accelerator.
type
Required only when the event parameter is a character or a virtual-key character. The type parameter specifies either ASCII or VIRTKEY; the integer value of event is interpreted accordingly. When VIRTKEY is specified and event contains a string, event must be uppercase.
options
Specifies the options that define the accelerator. This parameter can be one or more of the following values:
Option | Description
NOINVERT | Specifies that no top-level menu item is highlighted when the accelerator is used. This is useful when defining accelerators for actions such as scrolling that do not correspond to a menu item. If NOINVERT is omitted, a top-level menu item will be highlighted (if possible) when the accelerator is used.
ALT | Causes the accelerator to be activated only if the ALT key is down. Applies only to virtual keys.
SHIFT | Causes the accelerator to be activated only if the SHIFT key is down. Applies only to virtual keys
CONTROL | Defines the character as a control character (the accelerator is only activated if the CONTROL key is down). This has the same effect as using a caret (^) before the accelerator character in the event parameter. Applies only to virtual keys

Example

The following example demonstrates the use of accelerator keys:

1 ACCELERATORS
{
  "^C",  IDDCLEAR         ; control C
  "K",   IDDCLEAR         ; shift K
  "k",   IDDELLIPSE, ALT  ; alt k
  98,    IDDRECT, ASCII   ; b
  66,    IDDSTAR, ASCII   ; B (shift b)
  "g",   IDDRECT          ; g
  "G",   IDDSTAR          ; G (shift G)
  VK_F1, IDDCLEAR, VIRTKEY                ; F1
  VK_F1, IDDSTAR, CONTROL, VIRTKEY        ; control F1
  VK_F1, IDDELLIPSE, SHIFT, VIRTKEY       ; shift F1
  VK_F1, IDDRECT, ALT, VIRTKEY            ; alt F1
  VK_F2, IDDCLEAR, ALT, SHIFT, VIRTKEY    ; alt shift F2
  VK_F2, IDDSTAR, CONTROL, SHIFT, VIRTKEY ; ctrl shift F2
  VK_F2, IDDRECT, ALT, CONTROL, VIRTKEY   ; alt control F2
}

See Also

TranslateAccelerator
CHARACTERISTICS, DIALOG, LANGUAGE , MENU, RCDATA, STRINGTABLE, VERSION


BITMAP Resource

The BITMAP resource-definition statement specifies a bitmap that an application uses in its screen display or as an item in a menu or control.

Syntax

nameID BITMAP filename

Parameters

nameID
Specifies either a unique name or a 16-bit unsigned integer value identifying the resource.
filename
Specifies the name of the file that contains the resource. The name must be a valid filename; it must be a full path if the file is not in the current working directory. The path can either be a quoted or nonquoted string.

Example

The following example specifies two bitmap resources:

disk1   BITMAP disk.bmp
12      BITMAP diskette.bmp

See Also

LoadBitmap


CURSOR Resource

The CURSOR resource-definition statement specifies a bitmap that defines the shape of the cursor on the display screen or an animated cursor.

Syntax

nameID CURSOR filename

Parameters

nameID
Specifies either a unique name or a 16-bit unsigned integer identifying the resource.
filename
Specifies the name of the file that contains the resource. The name must be a valid filename; it must be a full path if the file is not in the current working directory. The path can either be a quoted or nonquoted string.

Remarks

Icon and cursor resources can contain more than one image.

Example

The following example specifies two cursor resources; one by name (cursor1) and the other by number (2):

cursor1 CURSOR bullseye.cur
2       CURSOR "d:\\cursor\\arrow.cur"


DIALOG Resource

The DIALOG resource-definition statement specifies a window that an application can use to create dialog boxes. The statement defines the position and dimensions of the dialog box on the screen as well as the dialog box style.

Syntax

nameID DIALOG x, y, width, height  [optional-statements]  {      control-statement      . . .  }

Parameters

nameID
Identifies the dialog box. This is either a unique name or a unique 16-bit unsigned integer value in the range 1 to 65,535.
option-statements
Specifies options for the dialog box. This can be zero or more of the following statements:
Statement | Description
CAPTION "text" | Specifies the caption of the dialog box if it has a title bar. For more information, see CAPTION.
CHARACTERISTICS
dword 		Specifies a user-defined DWORD value for use by resource tools. This value is not used by the system. For more information, see CHARACTERISTICS.
CLASS class | Specifies a 16-bit unsigned integer or a string, enclosed in double quotation marks ("), that identifies the class of the dialog box. For more information, see CLASS.
EXSTYLE=extended-styles | Specifies the extended window style of the dialog box. For more information, see EXSTYLE.
FONT pointsize, typeface | Specifies the point size and typeface for the font. For more information, see FONT.
LANGUAGE
language,sublanguage 		Specifies the language of the dialog box. For more information, see LANGUAGE.
MENU menuname | Specifies the menu to use. This value is either the name of the menu or its integer identifier.
STYLE styles | Specifies the styles of the dialog box. For more information, see STYLE.
VERSION dword | Specifies a user-defined DWORD value. This statement is intended for use by additional resource tools and is not used by the system. For more information, see VERSION.

For more information on the x, y, width, and height parameters, see Common Control Parameters.

Remarks

The GetDialogBaseUnits function returns the dialog base units in pixels. The exact meaning of the coordinates depends on the style defined by the STYLE option statement. For child-style dialog boxes, the coordinates are relative to the origin of the parent window, unless the dialog box has the style DS_ABSALIGN; in that case, the coordinates are relative to the origin of the display screen.

Do not use the WS_CHILD style with a modal dialog box. The DialogBox function always disables the parent/owner of the newly created dialog box. When a parent window is disabled, its child windows are implicitly disabled. Since the parent window of the child-style dialog box is disabled, the child-style dialog box is too.

If a dialog box has the DS_ABSALIGN style, the dialog coordinates for its upper-left corner are relative to the screen origin instead of to the upper-left corner of the parent window. You would typically use this style when you wanted the dialog box to start in a specific part of the display no matter where the parent window may be on the screen.

The name DIALOG can also be used as the class-name parameter to the CreateWindow function to create a window with dialog-box attributes.

Example

The following demonstrates the usage of the DIALOG statement:

#include <windows.h>

ErrorDialog DIALOG  10, 10, 300, 110
STYLE WS_POPUP | WS_BORDER
CAPTION "Error!"
{
    CTEXT "Select One:", 1, 10, 10, 280, 12
    PUSHBUTTON "&Retry", 2, 75, 30, 60, 12
    PUSHBUTTON "&Abort", 3, 75, 50, 60, 12
    PUSHBUTTON "&Ignore", 4, 75, 80, 60, 12
}

See Also

CONTROL, CreateDialog, CreateWindow, DialogBox, DIALOGEX, GetDialogBaseUnits, ACCELERATORS, CHARACTERISTICS, LANGUAGE, MENU, RCDATA, STRINGTABLE, VERSION


DIALOGEX Resource

The DIALOGEX resource-definition statement is an extension of the DIALOG resource-definition statement. In addition to the functionality offered by DIALOG, DIALOGEX allows for the following:

  • Help IDs on the dialog itself as well as on controls within the dialog.
  • Use of the EXSTYLE statement for the dialog itself as well as on controls within the dialog.
  • Font weight and italic settings for the font to be used in the dialog.
  • Control-specific data for controls within the dialog.
  • Use of the BEDIT, IEDIT, and HEDIT predefined system class names.

Syntax

nameID DIALOGEX x, y, width, height [ , helpID]]  [[ optional-statements]]  {       control-statements  }

Parameters

nameID
Identifies the dialog box. This is either a unique name or a unique 16-bit unsigned integer value in the range 1 to 65,535.
x
Specifies the location on the screen of the left side of the dialog, in dialog units.
y
Specifies the location on the screen of the top of the dialog, in dialog units.
width
Specifies the width of the dialog, in dialog units.
height
Specifies the height of the dialog, in dialog units.
helpID
Specifies a numeric expression indicating the ID used to identify the dialog during WM_HELP processing.
optional-statements
Specifies options for the dialog box. This can be zero or more of the following statements:
Statement | Description
CAPTION "text" | Specifies the caption of the dialog box if it has a title bar. For more information, see CAPTION.
CHARACTERISTICS
dword 		Specifies a user-defined DWORD value for use by resource tools. This value is not used by the system. For more information, see CHARACTERISTICS.
CLASS class | Specifies a 16-bit unsigned integer or a string, enclosed in double quotation marks ("), that identifies the class of the dialog box. For more information, see CLASS.
EXSTYLE=extended-styles | Specifies the extended window style of the dialog box. For more information, see EXSTYLE.
FONT pointsize, typeface,
weight, italic 		Specifies the point size and typeface for the font. For weight, use the FW_* values defined in WINGDI.H. For italic, specify TRUE to use an italic font, FALSE otherwise. For more information, see FONT.
LANGUAGE
language,sublanguage 		Specifies the language of the dialog box. For more information, see LANGUAGE.
MENU menuname | Specifies the menu to use. This value is either the name of the menu or its integer identifier.
STYLE styles | Specifies the styles of the dialog box. For more information, see STYLE.
VERSION dword | Specifies a user-defined DWORD value. This statement is intended for use by additional resource tools and is not used by the system. For more information, see VERSION.

control-statements
The body of the DIALOGEX resource is made up of any number of control statements. There are four families of control statements: generic, static, button, and edit. For more information, see Remarks.

Remarks

The valid operations that may be contained in any of the numeric expressions in the statements of DIALOGEX are as follows:

  • Add ('+')
  • Subtract ('-')
  • Unary minus ('-')
  • Unary NOT ('~')
  • AND ('&')
  • OR ('|')

The body of the resource is made up of generic, static, button, and edit control statements. While each of these families of statements uses a different syntax for defining specific features of its controls, they all share a common syntax for defining the position, size, extended styles, help identification number, and control-specific data. For more information, see Common Control Parameters.

Generic Control Statements

CONTROL controlText, id, className, style
controlText
Specifies the window text for the control. For more information, see Common Control Parameters.
id
Specifies the control identifier. For more information, see Common Control Parameters.
className
Specifies the name of the class. This may be either a string enclosed in double quotation marks (") or one of the following predefined system classes: BUTTON, STATIC, EDIT, LISTBOX, SCROLLBAR, or COMBOBOX.
style
Specifies the window styles (explicit WS_*, BS_*, SS_*, ES_*, LBS_*, SBS_*, and CBS_* style values defined in WINUSER.H can be used by adding an include to the RC file: #include "winuser.h")

Static Control Statements

staticClass controlText, id
staticClass
Specify LTEXT, RTEXT, or CTEXT.
controlText
Specifies the window text for the control. For more information, see Common Control Parameters.
id
Specifies the control identifier. For more information, see Common Control Parameters.

Button Control Statements

buttonClass controlText, id
buttonClass
Specify AUTO3STATE, AUTOCHECKBOX, AUTORADIOBUTTON, CHECKBOX, PUSHBOX, PUSHBUTTON, RADIOBUTTON, STATE3, or USERBUTTON.
controlText
Specifies the window text for the control. For more information, see Common Control Parameters.
id
Specifies the control identifier. For more information, see Common Control Parameters.

Edit Control Statements

editClass id
editClass
Specify EDITTEXT, BEDIT, HEDIT, or IEDIT.
id
Specifies the control identifier. For more information, see Common Control Parameters.

See Also

CONTROL, CreateDialog, CreateWindow, DialogBox, DIALOGEX, GetDialogBaseUnits, ACCELERATORS, CHARACTERISTICS, LANGUAGE, MENU, RCDATA, STRINGTABLE, VERSION


FONT Resource

The FONT resource-definition statement specifies a file that contains a font.

Syntax

nameID FONT [filename

Parameters

nameID
Specifies a unique 16-bit unsigned integer value identifying the resource.
filename
Specifies the name of the file that contains the resource. The name must be a valid filename; it must be a full path if the file is not in the current working directory. The path can either be a quoted or nonquoted string.

Example

The following example specifies a single font resource:

5 FONT  CMROMAN.FNT


ICON Resource

The ICON resource-definition statement specifies a bitmap that defines the shape of the icon to be used for a given application or an animated icon.

Syntax

nameID ICON filename

Parameters

nameID
Specifies either a unique name or a 16-bit unsigned integer value identifying the resource.
filename
Specifies the name of the file that contains the resource. The name must be a valid filename; it must be a full path if the file is not in the current working directory. The path can either be a quoted or nonquoted string.

Remarks

Icon and cursor resources can contain more than one image.

Example

The following example specifies two icon resources:

desk1   ICON desk.ico
11      ICON custom.ico


MENU Resource

The MENU resource-definition statement specifies the contents of a menu resource. A menu resource is a collection of information that defines the appearance and function of an application menu. A menu is a special input tool that lets a user select commands and open submenus from a list of menu items.

Syntax

menuID MENU  [[optional-statements]]  {      item-definitions      . . .  }

Parameters

menuID
A number that identifies the menu. This value is either a unique string or a unique 16-bit unsigned integer value in the range of 1 to 65,535.
optional-statements
This parameter can be zero of more of the following statements:
Statement | Description
CHARACTERISTICS dword | User-defined information about a resource that can be used by tools that read and write resource files.
LANGUAGE language, sublanguage | Specifies the language for the resource. The parameters are constants from WINNT.H.
VERSION dword | User-defined version number for the resource that can be used by tools that read and write resource files.

Example

Following is an example of a complete MENU statement:

sample MENU
{
     MENUITEM "&Soup", 100
     MENUITEM "S&alad", 101
     POPUP "&Entree"
     {
          MENUITEM "&Fish", 200
          MENUITEM  SEPARATOR                        //  Uniquement avec menu  (non avec menuEX)
          MENUITEM "&Chicken", 201, CHECKED
          POPUP "&Beef"
          {
               MENUITEM "&Steak", 301
               MENUITEM "&Prime Rib", 302
          }
     }
     MENUITEM "&Dessert", 103
}

See Also

MENUEX, MENUITEM, POPUP, ACCELERATORS, CHARACTERISTICS, DIALOG, LANGUAGE, RCDATA, STRINGTABLE, VERSION


MENUEX Resource

The MENUEX resource-definition statement is an extension of the MENU resource-definition statement. In addition to the functionality offered by MENU, MENUEX allows for the following:

  • Help identifiers on menus.
  • Identifiers on menus.
  • Use of the MFT_* type flags and MFS_* state flags. For more information on these flags, see the MENUITEMINFO structure.

Syntax

menuID MENUEX  {       [{[MENUITEM itemText [, [id] [, [type] [, state]]]] |      [POPUP    itemText [, [id] [, [type] [, [state] [, helpID]]]]        {            popupBody        }
      } ...]  }

Parameters

MENUITEM statement
Defines a menu item.
itemText
A string containing the text for the menu item. For more information, see MENUITEM.
id
A numeric expression indicating the identifier of the menu item.
type
A numeric expression indicating the type of the menu item To use the predefined MFT_* type values, include the following statement in your .RC file:
#include "winuser.h"
state
A numeric expression indicating the state of the menu item To use the predefined MFS_* state values, include the following statement in your .RC file:
#include "winuser.h"
POPUP statement
Defines a menu item that has a submenu associated with it.
itemText
A string containing the text for the menu item.
id
A numeric expression indicating the identifier of the menu item.
type
A numeric expression indicating the type of the menu item To use the predefined MFT_* type values, include the following statement in your .RC file:
#include "winuser.h"
state
A numeric expression indicating the state of the menu item To use the predefined MFS_* state values, include the following statement in your .RC file:
#include "winuser.h"
helpID
A numeric expression indicating the identifier used to identify the menu during WM_HELP processing.
popupBody
Contains any combination of the MENUITEM and POPUP statements.

Remarks

The valid arithmetic and Boolean operations that can be contained in any of the numeric expressions in the statements of MENUEX are as follows:

  • Add ('+')
  • Subtract ('-')
  • Unary minus ('-')
  • Unary NOT ('~')
  • AND ('&')
  • OR ('|')

See Also

MENU, MENUITEM, POPUP, ACCELERATORS, CHARACTERISTICS, DIALOG, LANGUAGE, RCDATA, STRINGTABLE, VERSION


MESSAGETABLE Resource

The MESSAGETABLE resource-definition statement defines the ID and file of an application's message table resource. Message tables are special string resources used in event logging and with the FormatMessage function. The file contains a binary message table generated by the message compiler, MC.EXE.

The message compiler also generates a resource script file that contains the MESSAGETABLE statements you need to include the message table resources in the compiled resource file. Use the #include directive to include this resource script into your main resource script.

Syntax

nameID MESSAGETABLE filename

Parameters

nameID
Specifies either a unique name or a 16-bit unsigned integer value identifying the resource.
filename
Specifies the name of the file that contains the resource. The name must be a valid filename; it must be a full path if the file is not in the current working directory. The path can either be a quoted or nonquoted string.

See Also

Using the Message Compiler, STRINGTABLE


POPUP Resource

The POPUP resource-definition statement creates a menu item that can contain menu items and submenus.

Syntax

POPUP text, [[optionlist]]    {       item-definitions      .      .      .  }

Parameters

text
A string that contains the name of the menu. This string must be enclosed in double quotation marks (").
optionlist
This parameter specifies redefined menu options that specify the appearance of the menu item. This optional parameter can be one or more of the following.
Option | Description
CHECKED | Menu item has a check mark next to it. This option is not valid for a top-level menu.
GRAYED | Menu item is initially inactive and appears on the menu in gray or a lightened shade of the menu-text color. This option cannot be used with the INACTIVE option.
HELP | Identifies a help item.
INACTIVE | Menu item is displayed but it cannot be selected. This option cannot be used with the GRAYED option.
MENUBARBREAK | Same as MENUBREAK except that for pop-up menus, it separates the new column from the old column with a vertical line.
MENUBREAK | Places the menu item on a new line for static menu-bar items. For menus, it places the menu item in a new column with no dividing line between the columns.

Example

The following example demonstrates the use of the POPUP statement:

chem MENU
{
    POPUP "&Elements"
    {
         MENUITEM "&Oxygen", 200
         MENUITEM "&Carbon", 201, CHECKED
         MENUITEM "&Hydrogen", 202
         MENUITEM SEPARATOR
         MENUITEM "&Sulfur", 203
         MENUITEM "Ch&lorine", 204
    }
    POPUP "&Compounds"
    {
         POPUP "&Sugars"
         {
            MENUITEM "&Glucose", 301
            MENUITEM "&Sucrose", 302, CHECKED
            MENUITEM "&Lactose", 303, MENUBREAK
            MENUITEM "&Fructose", 304
         }
         POPUP "&Acids"
         {
              "&Hydrochloric", 401
              "&Sulfuric", 402
         }
    }
}

See Also

MENU, MENUITEM


RCDATA Resource

The RCDATA resource-definition statement specifies a raw data resource for an application. Raw data resources permit the inclusion of binary data directly in the executable file.

Syntax

nameID RCDATA  [[optional-statements]]  {       raw-data      . . .  }

Parameters

nameID
Specifies either a unique name or a 16-bit unsigned integer value that identifies the resource.
optional-statements
Zero or more of the following statements:
Statement | Description
CHARACTERISTICS dword | User-defined information about a resource that can be used by tools that read and write resource files.
LANGUAGE language, sublanguage | Specifies the language for the resource. The parameters are constants from WINNT.H.
VERSION dword | User-defined version number for the resource that can be used by tools that read and write resource files.

raw-data
Specifies raw data consisting of one or more integers or strings of characters. Integers can be specified in decimal, octal, or hexadecimal format. To be compatible with 16-bit Windows, integers are stored as WORD values. You can store an integer as a DWORD value by qualifying the integer with the L suffix.

Strings are enclosed in quotation marks. RC does not automatically append a terminating null character to a string. Each string is a sequence of the specified ANSI characters, unless you qualify it as a wide-character string with the L prefix.

The block of data begins on a DWORD boundary and RC performs no padding or alignment of data within the raw-data block. It is your responsibility to ensure the proper alignment of data within the block.

Example

The following example demonstrates the use of the RCDATA statement:

resname RCDATA
{
   "Here is an ANSI string\0",    // explicitly null-terminated
   L"Here is a Unicode string\0", // explicitly null-terminated
   1024,                          // integer, stored as WORD
   7L,                            // integer, stored as DWORD
   0x029a,                        // hex integer
   0o733,                         // octal integer
}

See Also

ACCELERATORS, CHARACTERISTICS, DIALOG, LANGUAGE, MENU, STRINGTABLE, VERSION


STRINGTABLE Resource

The STRINGTABLE resource-definition statement specifies one or more string resources for an application. String resources are simply null-terminated Unicode strings that can be loaded when needed from the executable file, using the LoadString function.

Syntax

STRINGTABLE  [[optional-statements]]  {      stringID string      . . .  }

Parameters

optional-statements
Zero or more of the following statements:
Statement | Description
CHARACTERISTICS dword | User-defined information about a resource that can be used by tools that read and write resource files.
LANGUAGE language, sublanguage | Specifies the language for the resource. The parameters are constants from WINNT.H.
VERSION dword | User-defined version number for the resource that can be used by tools that read and write resource files.

stringID
Specifies an unsigned 16-bit integer that identifies the resource.
string
Specifies one or more strings, enclosed in double quotation marks. The string must be no longer than 4097 characters and must occupy a single line in the source file. To add a carriage return to the string, use this character sequence: \012. For example, "Line one\012Line two" would define a string that would be displayed as follows:
Line one
Line two

Remarks

RC allocates 16 strings per section and uses the identifier value to determine which section is to contain the string. Strings whose identifiers differ only in the bottom 4 bits are placed in the same section.

Example

The following example demonstrates the use of the STRINGTABLE statement:

#define IDS_HELLO    1
#define IDS_GOODBYE  2

STRINGTABLE
{
    IDS_HELLO,   "Hello"
    IDS_GOODBYE, "Goodbye"
}

See Also

LoadString, ACCELERATORS, CHARACTERISTICS, DIALOG, LANGUAGE, MENU, RCDATA, VERSION


User-Defined Resource

A user-defined resource-definition statement specifies a resource that contains application-specific data. The data can have any format and can be defined either as the content of a given file (if the filename parameter is given) or as a series of numbers and strings (if the raw-data block is given).

Syntax

nameID typeID filename

The filename specifies the name of a file containing the binary data of the resource. The contents of the file are included as the resource. RC does not interpret the binary data in any way. It is the programmer's responsibility to ensure that the data is properly aligned for the target computer architecture.

A user-defined resource can also be defined completely in the resource script using the following syntax:

nameID typeID   {      raw-data  }

Parameters

nameID
Specifies either a unique name or a 16-bit unsigned integer that identifies the resource.
typeID
Specifies either a unique name or a 16-bit unsigned integer that identifies the resource type. If a number is given, it must be greater than 255. The numbers 1 through 255 are reserved for existing and future redefined resource types.
filename
Specifies the name of the file that contains the resource data. The parameter must be a valid filename; it must be a full path if the file is not in the current working directory.
raw-data
Specifies raw data consisting of one or more integers or strings of characters. Integers can be specified in decimal, octal, or hexadecimal format. To be compatible with 16-bit Windows, integers are stored as WORD values. You can store an integer as a DWORD value by qualifying the integer with the L suffix.

Strings are enclosed in quotation marks. RC does not automatically append a terminating null character to a string. Each string is a sequence of the specified ANSI characters, unless you qualify it as a wide-character string with the L prefix.

The block of data begins on a DWORD boundary and RC performs no padding or alignment of data within the raw-data block. It is the programmer's responsibility to ensure the proper alignment of data within the block.

Example

The following example shows several user-defined statements:

array   MYRES   data.res
14      300     custom.res
18 MYRES2
{
   "Here is an ANSI string\0",    // explicitly null-terminated
   L"Here is a Unicode string\0", // explicitly null-terminated
   1024,                          // integer, stored as WORD
   7L,                            // integer, stored as DWORD
   0x029a,                        // hex integer
   0o733,                         // octal integer
}


Controls

AUTO3STATE | Creates an automatic three-state check box control.
AUTOCHECKBOX | Creates an automatic check box control.
AUTORADIOBUTTON | Creates an automatic radio button control.
CHECKBOX | Creates a check box control.
COMBOBOX | Creates a combo box control.
CONTROL | Creates an application-defined control.
CTEXT | Creates a centered-text control.
DEFPUSHBUTTON | Creates a default pushbutton control.
EDITTEXT | Creates an edit control.
GROUPBOX | Creates a group box control.
ICON | Creates an icon control. This control is an icon displayed in a dialog box.
LISTBOX | Creates a list box control.
LTEXT | Creates a left-aligned text control.
PUSHBOX | Creates a push box control.
PUSHBUTTON | Creates a push button control.
RADIOBUTTON | Creates a radio button control.
RTEXT | Creates a right-aligned control.
SCROLLBAR | Creates a scroll bar control.
STATE3 | Creates a three-state check box control.


AUTO3STATE Control

The AUTO3STATE resource-definition statement creates an automatic three-state check box. The control is an open box with the given text positioned to the right of the box. When chosen, the box automatically advances between three states: checked, unchecked, and disabled (grayed). The control sends a message to its parent whenever the user chooses the control.

Syntax

AUTO3STATE text, id, x, y, width, height [, style [, extended-style]]

Parameters

style
Specifies styles for the control, which can be a combination of the BS_AUTO3STATE style and the following styles: WS_TABSTOP, WS_DISABLED, and WS_GROUP.

If you do not specify a style, the default style is BS_AUTO3STATE | WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.

See Also

AUTOCHECKBOX, CHECKBOX, CONTROL, STATE3


AUTOCHECKBOX Control

The AUTOCHECKBOX resource-definition statement creates an automatic check box control. The control is a small rectangle (check box) that has the specified text displayed next to it (typically, to the right). When the user chooses the control, the control highlights the rectangle and sends a message to its parent window.

The AUTOCHECKBOX statement can only be used in the body of a DIALOG or DIALOGEX statement.

Syntax

AUTOCHECKBOX text, id, x, y, width, height [, style [, extended-style]]

Parameters

style
Specifies the styles of the control. This value can be a combination of the button class style BS_AUTOCHECKBOX and the WS_TABSTOP and WS_GROUP styles.

If you do not specify a style, the default style is BS_AUTOCHECKBOX | WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.

See Also

AUTO3STATE, CHECKBOX, CONTROL, STATE3


AUTORADIOBUTTON Control

The AUTORADIOBUTTON resource-definition statement creates an automatic radio button control. This control automatically performs mutual exclusion with the other AUTORADIOBUTTON controls in the same group. When the button is chosen, the application is notified with BN_CLICKED.

Syntax

AUTORADIOBUTTON text, id, x, y, width, height [, style [, extended-style]]

Parameters

text
The specified text appears next to the radio button.
style
Specifies styles for the automatic radio button, which can be a combination of BUTTON-class styles and the following styles: WS_TABSTOP, WS_DISABLED, and WS_GROUP.

If you do not specify a style, the default style is BS_AUTORADIOBUTTON | WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.

See Also

CONTROL, RADIOBUTTON


CHECKBOX Control

The CHECKBOX resource-definition statement creates a check box control. The control is a small rectangle (check box) that has the specified text displayed next to it (typically, to the right). When the user selects the control, the control highlights the rectangle and sends a message to its parent window.

The CHECKBOX statement, which can only be used in a DIALOG statement, defines the text, identifier, dimensions, and attributes of the control.

Syntax

CHECKBOX text, id, x, y, width, height [, style [, extended-style]]

Parameters

text
Specifies text that is displayed to the right of the control.
style
Specifies the control styles. This value can be a combination of the button class style BS_CHECKBOX and the WS_TABSTOP and WS_GROUP styles.

If you do not specify a style, the default style is BS_CHECKBOX | WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.

Example

This example creates a check-box control that is labeled Italic:

CHECKBOX "Italic", 3, 10, 10, 40, 10

See Also

AUTOCHECKBOX, AUTO3STATE, GetDialogBaseUnits, STATE3


COMBOBOX Control

The COMBOBOX resource-definition statement creates a combination box control (a combo box). A combo box consists of either a static text box or an edit box combined with a list box. The list box can be displayed at all times or pulled down by the user. If the combo box contains a static text box, the text box always displays the selection (if any) in the list box portion of the combo box. If it uses an edit box, the user can type in the desired selection; the list box highlights the first item (if any) that matches what the user has entered in the edit box. The user can then select the item highlighted in the list box to complete the choice. In addition, the combo box can be owner-drawn and of fixed or variable height.

Syntax

COMBOBOX id, x, y, width, height [, style [, extended-style]]

Parameters

style
Specifies the control styles. This value can be a combination of the COMBOBOX class styles and any of the following styles: WS_TABSTOP, WS_GROUP, WS_VSCROLL, and WS_DISABLED.

If you do not specify a style, the default style is CBS_SIMPLE | WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.

Example

This example creates a combo-box control with a vertical scroll bar:

COMBOBOX 777, 10, 10, 50, 54, CBS_SIMPLE | WS_VSCROLL | WS_TABSTOP


CONTROL Control

The CONTROL resource-definition statement creates a user-defined control.

Syntax

CONTROL text, id, class, style, x, y, width, height [, extended-style]

Parameters

class
Specifies a redefined name, character string, or a 16-bit unsigned integer value that defines the class. This can be any one of the control classes; for a list of the control classes, see the first list following this description. If the value is a redefined name supplied by the application, it must be a string enclosed in double quotation marks (").
style
Specifies a redefined name or integer value that specifies the style of the given control. The exact meaning of style depends on the class value. The sections following this description show the control classes and corresponding styles.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.

The six possible control classes are described in the following sections.

The Button Control Class

A button control is a small rectangular child window that the user can turn on or off by clicking it with the mouse. Button controls can be used alone or in groups, and can either be labeled or appear without text. Button controls typically change appearance when the user clicks them.

A button can have only one of the following styles, with the exception of BS_LEFTTEXT, which can be combined with check boxes and radio buttons:

Style Meaning
BS_3STATE
Creates a button that is the same as a check box, except that the box can be grayed (dimmed) as well as checked. The grayed state is used to show that the state of the check box is not determined.
BS_AUTO3STATE
Creates a button that is the same as a three-state check box, except that the box changes its state when the user selects it. The state cycles through checked, grayed, and normal.
BS_AUTOCHECKBOX
Creates a button that is the same as a check box, except that an X appears in the check box when the user selects the box; the X disappears (is cleared) the next time the user selects the box.
BS_AUTORADIOBUTTON
Creates a button that is the same as a radio button, except that when the user selects it, the button automatically highlights itself and clears (removes the selection from) any other buttons in the same group.
BS_CHECKBOX
Creates a small square that has text displayed to its right (unless this style is combined with the BS_LEFTTEXT style).
BS_DEFPUSHBUTTON
Creates a button that has a heavy black border. The user can select this button by pressing the ENTER key. This style is useful for enabling the user to quickly select the most likely option (the default option).
BS_GROUPBOX
Creates a rectangle in which other controls can be grouped. Any text associated with this style is displayed in the rectangle's upper-left corner.
BS_LEFTTEXT
Places text on the left side of the radio button or check box when combined with a radio button or check box style.
BS_OWNERDRAW
Creates an owner-drawn button. The owner window receives a WM_MEASUREITEM message when the button is created, and it receives a WM_DRAWITEM message when a visual aspect of the button has changed. The BS_OWNERDRAW style cannot be combined with any other button styles.
BS_PUSHBUTTON
Creates a push button that posts a WM_COMMAND message to the owner window when the user selects the button.
BS_RADIOBUTTON
Creates a small circle that has text displayed to its right (unless this style is combined with the BS_LEFTTEXT style). Radio buttons are usually used in groups of related but mutually exclusive choices.

The Combo Box Control Class

Combo box controls consist of a selection field similar to an edit control plus a list box. The list box may be displayed at all times or may be dropped down when the user selects a "pop box" next to the selection field.

Depending on the style of the combo box, the user can or cannot edit the contents of the selection field. If the list box is visible, typing characters into the selection box will cause the first entry that matches the characters typed to be highlighted. Conversely, selecting an item in the list box displays the selected text in the selection field. Combo box control styles are described below.

Style Meaning
CBS_SIMPLE
Displays the list box at all times. The current selection in the list box is displayed in the edit control.
CBS_DROPDOWN
Similar to CBS_SIMPLE except that the list box is not displayed unless the user selects an icon next to the selection field.
CBS_DROPDOWNLIST
Similar to CBS_DROPDOWN except that the edit control is replaced by a static text item which displays the current selection in the list box.
CBS_OWNERDRAWFIXED
Specifies a fixed-height owner-draw combo box. The owner of the list box is responsible for drawing its contents; the items in the list box are all the same height.
CBS_OWNERDRAWVARIABLE
Specifies a variable-height owner-draw combo box. The owner of the list box is responsible for drawing its contents; the items in the list box can have different heights.
CBS_AUTOHSCROLL
Scrolls the text in the edit control to the right when the user types a character at the end of the line. If this style is not set, only text that fits within the rectangular boundary is allowed.
CBS_SORT
Sorts strings entered into the list box.
CBS_HASSTRINGS
Specifies an owner-draw combo box that contains items consisting of strings. The combo box maintains the memory and pointers for the strings so that the application can use the LB_GETTEXT message to retrieve the text for a particular item.
CBS_OEMCONVERT
Converts text entered in the combo box edit control from the ANSI character set to the OEM character set and then back to ANSI. This ensures proper character conversion when the application calls the CharToOem function to convert an ANSI string in the combo box to OEM characters. This style is most useful for combo boxes that contain filenames and applies only to combo boxes created with the CBS_SIMPLE or CBS_DROPDOWN styles.

The Edit Control Class

An edit control is a rectangular child window in which the user can enter text from the keyboard. The user selects the control, and gives it the input focus, by clicking the mouse inside it or pressing the TAB key. The user can enter text when the control displays a flashing insertion point. The mouse can be used to move the cursor and select characters to be replaced, or to position the cursor for inserting characters. The BACKSPACE key can be used to delete characters.

Edit controls use the fixed-pitch font and display Unicode characters. They expand tab characters into as many space characters as are required to move the cursor to the next tab stop. Tab stops are assumed to be at every eighth character position. Edit control styles are described below.

Style | Meaning
ES_LEFT | Justifies the text to the left.
ES_CENTER
Centers the text. This style is valid in multiline edit controls only.
ES_RIGHT
Justifies the text to the right. This style is valid in multiline edit controls only.
ES_LOWERCASE
Converts all characters to lowercase as they are typed into the edit control.
ES_UPPERCASE
Converts all characters to uppercase as they are typed into the edit control.
ES_PASSWORD
Displays all characters as an asterisk (*) as they are typed into the edit control. An application can use the EM_SETPASSWORDCHAR message to change the character that is displayed.
ES_MULTILINE
Multiple-line edit control. (The default is single-line.) Shows as many lines of text as possible. The following four styles specify options for horizontal and vertical scrolling.
ES_AUTOVSCROLL
If used, shows as many lines as possible and scrolls vertically when the user presses ENTER.
Otherwise, shows as many lines as possible and beeps if the user presses ENTER when no more lines can be displayed.
ES_AUTOHSCROLL
If used, scrolls horizontally when the insertion point goes past the right edge of the control. To start a new line, press ENTER.
Otherwise, wraps words to the beginning of the next line when necessary. A new line is also started if the user presses ENTER.
A multiline edit control with scroll bars processes its own scroll-bar messages.
ES_AUTOVSCROLL
Scrolls text automatically up one page when the user presses ENTER on the last line.
ES_AUTOHSCROLL
Scrolls text automatically to the right by 10 characters when the user types a character at the end of the line. When the user presses ENTER, the control scrolls all text to position 0.
ES_NOHIDESEL
Overrides the default action, in which an edit control hides the selection when the control loses the input focus. Inverts the selection instead.
ES_OEMCONVERT
Converts text entered in the edit control from the ANSI character set to the OEM character set and then back to ANSI. This ensures proper character conversion when the application calls the CharToOem function to convert an ANSI string in the edit control to OEM characters. This style is most useful for edit controls that contain filenames.

The Listbox Control Class

Listbox controls consist of a list of character strings. The control is used whenever an application needs to present a list of names, such as filenames, that the user can view and select. The user can select a string by pointing to the string with the mouse and clicking a mouse button. When a string is selected, it is highlighted and a notification message is passed to the parent window. A scroll bar can be used with a listbox control to scroll lists that are too long or too wide for the control window. Listbox control styles are described below.

Style Meaning
LBS_STANDARD
Strings in the list box are sorted alphabetically and the parent window receives an input message whenever the user clicks or double-clicks a string. The list box contains borders on all sides.
LBS_DISABLENOSCROLL
Shows a disabled vertical scroll bar for the list box when the box does not contain enough items to scroll. If this style is not specified, the scroll bar is hidden when the list box does not contain enough items.
LBS_EXTENDEDSEL
The user can select multiple items using the mouse with the SHIFT and/or the CONTROL key or special key combinations.
LBS_HASSTRINGS
An owner-draw list box contains items consisting of strings. The list box maintains the memory and pointers for the strings so the application can use the LB_GETTEXT message to retrieve the text for a particular item.
LBS_NOTIFY
The parent receives an input message whenever the user clicks or double-clicks a string.
LBS_MULTIPLESEL
The string selection is toggled each time the user clicks or double-clicks the string. Any number of strings can be selected.
LBS_MULTICOLUMN
The list box contains multiple columns. The list box can be scrolled horizontally. The LB_SETCOLUMNWIDTH message sets the width of the columns.
LBS_NOINTEGRALHEIGHT
The size of the list box is exactly the size specified by the application when it created the list box. Normally, the system sizes a list box so that the list box does not display partial items.
LBS_SORT
The strings in the list box are sorted alphabetically.
LBS_NOREDRAW
The list-box display is not updated when changes are made. This style can be changed at any time by sending a WM_SETREDRAW message.
LBS_OWNERDRAWFIXED
The owner of the list box is responsible for drawing its contents; the items in the list box are all the same height.
LBS_OWNERDRAWVARIABLE
The owner of the list box is responsible for drawing its contents; the items in the list box are variable in height.
LBS_USETABSTOPS
The list box is able to recognize and expand tab characters when drawing its strings. The default tab positions are set at every 32 dialog units. (A dialog unit is a horizontal or vertical distance. One horizontal dialog unit is equal to 1/4 of the current dialog base width unit. The dialog base units are computed from the height and width of the current system font. The GetDialogBaseUnits function returns the size of the dialog base units in pixels.)
LBS_WANTKEYBOARDINPUT
The owner of the list box receives WM_VKEYTOITEM or WM_CHARTOITEM messages whenever the user presses a key while the list box has input focus. This allows an application to perform special processing on the keyboard input.

The Scroll-Bar Control Class

A scroll-bar control is a rectangle that contains a scroll thumb and has direction arrows at both ends. The scroll bar sends a notification message to its parent whenever the user clicks the mouse in the control. The parent is responsible for updating the thumb position, if necessary. Scroll-bar controls have the same appearance and function as the scroll bars used in ordinary windows. But unlike scroll bars, scroll-bar controls can be positioned anywhere within a window and used whenever needed to provide scrolling input for a window. Scroll-bar control styles are described below.

Style Meaning
SBS_VERT
Vertical scroll bar. If neither SBS_RIGHTALIGN nor SBS_LEFTALIGN is specified, the scroll bar has the height, width, and position given in the CreateWindow function.
SBS_RIGHTALIGN
Used with SBS_VERT. The right edge of the scroll bar is aligned with the right edge of the rectangle specified by the x, y, width, and height values given in the CreateWindow function. The scroll bar has the default width for system scroll bars.
SBS_LEFTALIGN
Used with SBS_VERT. The left edge of the scroll bar is aligned with the left edge of the rectangle specified by the x, y, width, and height values given in the CreateWindow function. The scroll bar has the default width for system scroll bars.
SBS_HORZ
Horizontal scroll bar. If neither SBS_BOTTOMALIGN nor SBS_TOPALIGN is specified, the scroll bar has the height, width, and position given in the CreateWindow function.
SBS_TOPALIGN
Used with SBS_HORZ. The top edge of the scroll bar is aligned with the top edge of the rectangle specified by the x, y, width, and height values given in the CreateWindow function. The scroll bar has the default height for system scroll bars.
SBS_BOTTOMALIGN
Used with SBS_HORZ. The bottom edge of the scroll bar is aligned with the bottom edge of the rectangle specified by the x, y, width, and height values given in the CreateWindow function. The scroll bar has the default height for system scroll bars.
SBS_SIZEBOX
Size box. If neither SBS_SIZEBOXBOTTOMRIGHTALIGN nor SBS_SIZEBOXTOPLEFTALIGN is specified, the size box has the height, width, and position given in the CreateWindow function.
SBS_SIZEBOXTOPLEFTALIGN
Used with SBS_SIZEBOX. The top-left corner of the size box is aligned with the top-left corner of the rectangle specified by the x, y, width, and height values given in the CreateWindow function. The size box has the default size for system size boxes.
SBS_SIZEBOXBOTTOMRIGHTALIGN
Used with SBS_SIZEBOX. The bottom-right corner of the size box is aligned with the bottom-right corner of the rectangle specified by the x, y, width, and height values given in the CreateWindow function. The size box has the default size for system size boxes.

The Static Control Class

Static controls are simple text fields, boxes, and rectangles that can be used to label, box, or separate other controls. Static controls take no input and provide no output. Static control styles are described below.

Style Meaning
SS_LEFT
A simple rectangle displaying the given text flush left. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line.
SS_CENTER
A simple rectangle displaying the given text centered. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line.
SS_RIGHT
A simple rectangle displaying the given text flush right. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line.
SS_LEFTNOWORDWRAP
A simple rectangle displaying the given text flush left. Tabs are expanded, but words are not wrapped. Text that extends past the end of a line is clipped.
SS_SIMPLE
A simple rectangle with a single line of text flush left. The line of text cannot be shortened or altered in any way. (The control's parent window or dialog box must not process the WM_CTLCOLOR message.)
SS_NOPREFIX
Removes any ampersand (&) characters and underlines the next character in the string. Unless this style is specified, the system will interpret any ampersand characters in the control's text to be accelerator prefix characters. If a static control is to contain text where this feature is not wanted, SS_NOPREFIX may be added. This static-control style may be included with any of the defined static controls. You can combine SS_NOPREFIX with other styles by using the bitwise OR (|) operator. This is most often used when filenames or other strings that may contain an ampersand need to be displayed in a static control in a dialog box.
SS_ICON
An icon displayed in the dialog box. The given text is the name of an icon (not a filename) defined elsewhere in the resource file. For the ICON statement, the width and height parameters in the CreateWindow function are ignored; the icon automatically sizes itself.
SS_BLACKRECT
A rectangle filled with the color used to draw window frames. This color is black in the default color scheme.
SS_GRAYRECT
A rectangle filled with the color used to fill the screen background. This color is gray in the default color scheme.
SS_WHITERECT
A rectangle filled with the color used to fill window backgrounds. This color is white in the default color scheme.
SS_BLACKFRAME
Box with a frame drawn with the same color as window frames. This color is black in the default color scheme.
SS_GRAYFRAME
Box with a frame drawn with the same color as the screen background (desktop). This color is gray in the default color scheme.
SS_WHITEFRAME
Box with a frame drawn with the same color as window backgrounds. This color is white in the default color scheme.
SS_USERITEM
User-defined item.


CTEXT Control

The CTEXT resource-definition statement creates a centered-text control. The control is a simple rectangle displaying the given text centered in the rectangle. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line.

The CTEXT statement, which you can use only in a DIALOG statement, defines the text, identifier, dimensions, and attributes of the control.

Syntax

CTEXT text, id, x, y, width, height [, style [, extended-style]]

Parameters

text
Specifies text that is centered in the rectangular area of the control.
style
Specifies the control styles. This value can be any combination of the following styles: SS_CENTER, WS_TABSTOP, and WS_GROUP.

If you do not specify a style, the default style is SS_CENTER | WS_GROUP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.

Example

This example creates a centered-text control that is labeled Filename:

CTEXT "Filename", 101, 10, 10, 100, 100

See Also

CONTROL, DIALOG, LTEXT, RTEXT


DEFPUSHBUTTON Control

The DEFPUSHBUTTON resource-definition statement creates a default push-button control. The control is a small rectangle with a bold outline that represents the default response for the user. The given text is displayed inside the button. The control highlights the button in the usual way when the user clicks the mouse in it and sends a message to its parent window.

Syntax

DEFPUSHBUTTON text, id, x, y, width, height [, style [, extended-style]]

Parameters

text
Specifies text that is centered in the rectangular area of the control.
style
Specifies the control styles. This value can be a combination of the following styles: BS_DEFPUSHBUTTON, WS_TABSTOP, WS_GROUP, and WS_DISABLED.

If you do not specify a style, the default style is BS_DEFPUSHBUTTON | WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.

Example

This example creates a default push-button control that is labeled Cancel:

DEFPUSHBUTTON "Cancel", 101, 10, 10, 24, 50

See Also

PUSHBUTTON, RADIOBUTTON


EDITTEXT Control

The EDITTEXT resource-definition statement creates an edit control belonging to the EDIT class. It creates a rectangular region in which the user can type and edit text. The control displays a cursor when the user clicks the mouse in it. The user can then use the keyboard to enter text or edit the existing text. Editing keys include the BACKSPACE and DELETE keys. The user can also use the mouse to select characters to be deleted or to select the place to insert new characters.

Syntax

EDITTEXT id, x, y, width, height [[, style [[, extended-style]]]]

Parameters

style
Specifies the control styles. This value can be a combination of the edit class styles and the following styles: WS_TABSTOP, WS_GROUP, WS_VSCROLL, WS_HSCROLL, and WS_DISABLED.

If you do not specify a style, the default style is ES_LEFT | WS_BORDER | WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.

Example

The following example demonstrates the use of the EDITTEXT statement:

EDITTEXT  3, 10, 10, 100, 10


GROUPBOX Control

The GROUPBOX resource-definition statement creates a group box control. The control is a rectangle that groups other controls together. The controls are grouped by drawing a border around them and displaying the given text in the upper-left corner.

The GROUPBOX statement, which you can use only in a DIALOG statement, defines the text, identifier, dimensions, and attributes of a control window.

When the style contains WS_TABSTOP or the text specifies an accelerator, tabbing or pressing the accelerator key moves the focus to the first control within the group.

Syntax

GROUPBOX text, id, x, y, width, height [[, style [[, extended-style]]]]

Parameters

style
Specifies the control styles. This value can be a combination of the button class style BS_GROUPBOX and the WS_TABSTOP and WS_DISABLED styles.

If you do not specify a style, the default style is BS_GROUPBOX.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.

Example

This example creates a group-box control that is labeled Options:

GROUPBOX "Options", 101, 10, 10, 100, 100

See Also

DIALOG


ICON Control

The ICON resource-definition statement creates an icon control. This control is an icon displayed in a dialog box.

The ICON control statement, which you can use only in a DIALOG statement, defines the icon-resource identifier, icon-control identifier, position, and attributes of a control.

Syntax

ICON text, id, x, y, [[width, height, style [[, extended-style]]]]

Parameters

text
Specifies the name of an icon (not a filename) defined elsewhere in the resource file.
width
This value is ignored and should be set to zero.
height
This value is ignored and should be set to zero.
style
Specifies the control style. This parameter is optional. The only value that can be specified is the SS_ICON style. This is the default style whether this parameter is specified or not.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.

Example

This example creates an icon control whose icon identifier is 901 and whose name is myicon:

ICON "myicon" 901, 30, 30

See Also

DIALOG, ICON


LISTBOX Control

The LISTBOX resource-definition statement creates commonly used controls for a dialog box or window. The control is a rectangle containing a list of strings (such as filenames) from which the user can select.

The LISTBOX statement, which can only be used in a DIALOG or WINDOW statement, defines the identifier, dimensions, and attributes of a control window.

Syntax

LISTBOX id, x, y, width, height [[, style [[, extended-style]]]]

Parameters

style
Specifies the control styles. This value can be a combination of the list-box class styles and any of the following styles: WS_BORDER and WS_VSCROLL.

If you do not specify a style, the default style is LBS_NOTIFY | WS_BORDER.

For more information on the id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.

Example

This example creates a list-box control whose identifier is 101:

LISTBOX 101, 10, 10, 100, 100

See Also

COMBOBOX, DIALOG


LTEXT Control

The LTEXT resource-definition statement creates a left-aligned text control. The control is a simple rectangle displaying the given text left-aligned in the rectangle. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line.

The LTEXT statement, which can be used only in a DIALOG statement, defines the text, identifier, dimensions, and attributes of the control.

Syntax

LTEXT text, id, x, y, width, height [[, style [[, extended-style]]]]

Parameters

style
Specifies the control styles. This value can be any combination of the BS_RADIOBUTTON style and the following styles: SS_LEFT, WS_TABSTOP, and WS_GROUP.

If you do not specify a style, the default style is SS_LEFT | WS_GROUP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.

Example

This example creates a left-aligned text control that is labeled Filename:

LTEXT "Filename", 101, 10, 10, 100, 100

See Also

CONTROL, CTEXT, DIALOG, RTEXT


PUSHBOX Control

The PUSHBOX resource-definition statement creates a push-box control, which is identical to a PUSHBUTTON, except that it does not display a button face or frame; only the text appears.

Syntax

PUSHBOX text, id, x, y, width, height [[, style [[, extended-style]]]]

Parameters

style
Specifies styles for the pushbox, which can be a combination of the BS_PUSHBOX style and the following styles: WS_TABSTOP, WS_DISABLED, and WS_GROUP.

If you do not specify a style, the default style is BS_PUSHBOX | WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.

See Also

PUSHBUTTON


PUSHBUTTON Control

The PUSHBUTTON resource-definition statement creates a push-button control. The control is a round-cornered rectangle containing the given text. The text is centered in the control. The control sends a message to its parent whenever the user chooses the control.

Syntax

PUSHBUTTON text, id, x, y, width, height [[, style [[, extended-style]]]]

Parameters

style
Specifies styles for the pushbutton, which can be a combination of the BS_PUSHBUTTON style and the following styles: WS_TABSTOP, WS_DISABLED, and WS_GROUP.

If you do not specify a style, the default style is BS_PUSHBUTTON | WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.

Example

The following example demonstrates the use of the PUSHBUTTON statement:

PUSHBUTTON "ON", 7, 10, 10, 20, 10

See Also

GetDialogBaseUnits


RADIOBUTTON Control

The RADIOBUTTON resource-definition statement creates a radio-button control. The control is a small circle that has the given text displayed next to it, typically to its right. The control highlights the circle and sends a message to its parent window when the user selects the button. The control removes the highlight and sends a message when the button is next selected.

Syntax

RADIOBUTTON text, id, x, y, width, height [[, style [[, extended-style]]]]

Parameters

style
Specifies styles for the radio button, which can be a combination of BUTTON-class styles and the following styles: WS_TABSTOP, WS_DISABLED, and WS_GROUP.

If you do not specify a style, the default style is BS_RADIOBUTTON | WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.

Example

The following example demonstrates the use of the RADIOBUTTON statement:

RADIOBUTTON "Italic", 100, 10, 10, 40, 10

See Also

GetDialogBaseUnits


RTEXT Control

The RTEXT resource-definition statement creates a right-aligned text control. The control is a simple rectangle displaying the given text right-aligned in the rectangle. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line.

Syntax

RTEXT text, id, x, y, width, height [[, style [[, extended-style]]]]

Parameters

style
Specifies styles for the text control, which can be any combination of the following: WS_TABSTOP and WS_GROUP.

If you do not specify a style, the default style is SS_RIGHT | WS_GROUP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.

Example

The following example demonstrates the use of the RTEXT statement:

RTEXT "Number of Messages", 4, 30, 50, 100, 10

See Also

CONTROL, CTEXT, DIALOG, LTEXT


SCROLLBAR Control

The SCROLLBAR resource-definition statement creates a scroll-bar control. The control is a rectangle that contains a scroll box and has direction arrows at both ends. The scroll-bar control sends a notification message to its parent whenever the user clicks the mouse in the control. The parent is responsible for updating the scroll-box position. Scroll-bar controls can be positioned anywhere in a window and used whenever needed to provide scrolling input.

Syntax

SCROLLBAR text, id, x, y, width, height [[, style [[, extended-style]]]]

Parameters

style
Specifies a combination (or none) of the following styles: WS_TABSTOP, WS_GROUP, and WS_DISABLED.

In addition to these styles, the style parameter may contain a combination (or none) of the SCROLLBAR-class styles.

If you do not specify a style, the default style is SBS_HORZ.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.

Example

The following example demonstrates the use of the SCROLLBAR statement:

SCROLLBAR 999, 25, 30, 10, 100


STATE3 Control

The STATE3 resource-definition statement defines a three-state check box control. The control is identical to a CHECKBOX, except that it has three states: checked, unchecked, and disabled (grayed).

Syntax

STATE3 text, id, x, y, width, height [[, style [[, extended-style]]]]

Parameters

text
Specifies text that is displayed to the right of the control.
style
Specifies the control styles. This value can be a combination of the button class style BS_3STATE and the WS_TABSTOP and WS_GROUP styles.

If you do not specify a style, the default style is BS_3STATE | WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.

See Also

AUTOCHECKBOX, CHECKBOX, CONTROL


Nouvelle page 1

Statements

CAPTION | Sets the title for a dialog box.
CHARACTERISTICS | Specifies information about a resource that can be used by tool that can read or write resource-definition files.
CLASS | Sets the class of the dialog box.
EXSTYLE | Sets the extended window style of the dialog box.
FONT | Sets the font with which the system will draw text for the dialog box.
LANGUAGE | Sets the language for all resources up to the next LANGUAGE statement or to the end of the file. When the LANGUAGE statement appears before the beginning of the body of an ACCELERATORS, DIALOG, MENU, RCDATA, or STRINGTABLE resource definition, the specified language applies only to that resource.
MENU | Sets the menu for the dialog box.
MENUITEM | Defines a menu item.
STYLE | Sets the window style for the dialog box.
VERSION | Specifies version information for a resource that can be used by tool that can read or write resource-definition files.


CAPTION Statement

The CAPTION resource-definition statement sets the title for a dialog box. The title appears in the box's caption bar (if it has one).

The default caption is empty.

Syntax

CAPTION "captiontext"

Parameters

captiontext
Specifies a character string enclosed in double quotation marks (").

Example

The following example demonstrates the use of the CAPTION statement:

CAPTION "Error!"


CHARACTERISTICS Statement

The CHARACTERISTICS resource-definition statement specifies information about a resource that can be used by tools that read and write resource-definition files. The specified DWORD value appears with the resource in the compiled .RES file. However, the value is not stored in the executable file and has no significance to the system.

The CHARACTERISTICS statement appears before the beginning of the body of an ACCELERATORS, DIALOG, MENU, RCDATA, or STRINGTABLE resource definition. The specified value applies only to that resource.

Syntax

CHARACTERISTICS dword

Parameters

dword
A user-defined DWORD value.

See Also

ACCELERATORS, DIALOG, LANGUAGE, MENU, RCDATA, STRINGTABLE


CLASS Statement

The CLASS resource-definition statement sets the class of the dialog box.

The CLASS statement appears in the optional section before a DIALOG statement's main. If no class is given, the standard dialog class is used.

Syntax

CLASS class

Parameters

class
Specifies a 16-bit unsigned integer or a string, enclosed in double quotation marks ("), that identifies the class of the dialog box. If the window procedure for the class does not process a message sent to it, it must call the DefDlgProc function to ensure that all messages are handled properly for the dialog box. A private class can use DefDlgProc as the default window procedure. The class must be registered with the cbWndExtra member of the WNDCLASS structure set to DLGWINDOWEXTRA.

Remarks

The CLASS statement should only be used with special cases, because it overrides the normal processing of a dialog box. The CLASS statement converts a dialog box to a window of the specified class; depending on the class, this could give undesirable results. Do not use the redefined control-class names with this statement.

Example

The following example demonstrates the use of the CLASS statement:

CLASS "myclass"

See Also

DefDlgProc, DIALOG


EXSTYLE Statement

The EXSTYLE resource-definition statement sets extended window styles for a dialog box. In a resource definition, the EXSTYLE statement is placed with the optional statements before the beginning of the body of the resource definition.

Syntax

EXSTYLE extended-style

Parameters

extended-style
The extended window style for the dialog box or control. This parameter can be one of the following values:
Style | Meaning
WS_EX_ACCEPTFILES | Specifies that a window created with this style accepts drag-drop files.
WS_EX_APPWINDOW | Forces a top-level window onto the taskbar when the window is visible.
WS_EX_CLIENTEDGE | Specifies that a window has a border with a sunken edge.
WS_EX_CONTEXTHELP Includes a question mark in the title bar of the window. When the user clicks the question mark, the cursor changes to a question mark with a pointer. If the user then clicks a child window, the child receives a WM_HELP message. The child window should pass the message to the parent window procedure, which should call the WinHelp function using the HELP_WM_HELP command. The Help application displays a pop-up window that typically contains help for the child window.

WS_EX_CONTEXTHELP cannot be used with the WS_MAXIMIZEBOX or WS_MINIMIZEBOX styles.
WS_EX_CONTROLPARENT | Allows the user to navigate among the child windows of the window by using the tab key.
WS_EX_DLGMODALFRAME | Creates a window that has a double border; the window can, optionally, be created with a title bar by specifying the WS_CAPTION style in the dwStyle parameter.
WS_EX_LEFT | Window has generic "left-aligned" properties. This is the default.
WS_EX_LEFTSCROLLBAR | If the shell language is Hebrew, Arabic, or another language that supports reading order alignment, the vertical scroll bar (if present) is to the left of the client area. For other languages, the style is ignored and not treated as an error.
WS_EX_LTRREADING | The window text is displayed using Left to Right reading-order properties. This is the default.
WS_EX_MDICHILD | Creates an MDI child window.
WS_EX_NOPARENTNOTIFY | Specifies that a child window created with this style does not send the WM_PARENTNOTIFY message to its parent window when it is created or destroyed.
WS_EX_OVERLAPPEDWINDOW | Combines the WS_EX_CLIENTEDGE and WS_EX_WINDOWEDGE styles.
WS_EX_PALETTEWINDOW | Combines the WS_EX_WINDOWEDGE, WS_EX_TOOLWINDOW, and WS_EX_TOPMOST styles.
WS_EX_RIGHT | The window has generic "right-aligned" properties. This depends on the window class. This style has an effect only if the shell language is Hebrew, Arabic, or another language that supports reading order alignment; otherwise, the style is ignored and not treated as an error.
WS_EX_RIGHTSCROLLBAR | Vertical scroll bar (if present) is to the right of the client area. This is the default.
WS_EX_RTLREADING | If the shell language is Hebrew, Arabic, or another language that supports reading order alignment, the window text is displayed using Right to Left reading-order properties. For other languages, the style is ignored and not treated as an error.
WS_EX_STATICEDGE | Creates a window with a three-dimensional border style intended to be used for items that do not accept user input.
WS_EX_TOOLWINDOW | Creates a tool window; that is, a window intended to be used as a floating toolbar. A tool window has a title bar that is shorter than a normal title bar, and the window title is drawn using a smaller font. A tool window does not appear in the taskbar or in the dialog that appears when the user presses alt+tab. If a tool window has a system menu, its icon is not displayed on the title bar. However, you can display the system menu by right-clicking or by typing alt+space.
WS_EX_TOPMOST | Specifies that a window created with this style should be placed above all non-topmost windows and should stay above them, even when the window is deactivated. To add or remove this style, use the SetWindowPos function.
WS_EX_TRANSPARENT Specifies that a window created with this style should not be painted until siblings beneath the window (that were created by the same thread) have been painted. The window appears transparent because the bits of underlying sibling windows have already been painted.

To achieve transparency without these restrictions, use the SetWindowRgn function.
WS_EX_WINDOWEDGE | Specifies that a window has a border with a raised edge.

Remarks

For controls, extended styles are specified after the style option in the control resource-definition statement. For more information, see the resource-definition statement for the individual control.

See also

ACCELERATORS, CONTROL, DIALOG, MENU, POPUP, RCDATA, STRINGTABLE, User-Defined Resource


FONT Statement

The FONT resource-definition statement sets the font with which the system will draw text in the dialog box. The font must have been previously loaded, either from the WIN.INI file or by calling the LoadResource function.

Syntax

FONT pointsize, "typeface"

Parameters

pointsize
Specifies the size, in points, of the font.
typeface
Specifies the name of the typeface. This name must be identical to the name defined in the [FONTS] section of WIN.INI. This parameter must be enclosed in double quotes (").

Example

The following example demonstrates the use of the FONT statement:

FONT 12, "MS Shell Dlg"

See Also

DIALOG, LoadResource


LANGUAGE Statement

The LANGUAGE resource-definition statement specifies the language for all resources up to the next LANGUAGE statement or to the end of the file.

When the LANGUAGE statement appears before the beginning of the body of an ACCELERATORS, DIALOG, MENU, RCDATA, or STRINGTABLE resource definition, the specified language applies only to that resource.

Syntax

LANGUAGE language, sublanguage

Parameters

language
Language identifier. Must be one of the LANG_ constants from WINNT.H
sublanguage
Sublanguage identifier. Must be one of the SUBLANG_ constants from WINNT.H

See Also

ACCELERATORS, CHARACTERISTICS, DIALOG, MENU, RCDATA, STRINGTABLE, VERSION


MENU Statement

The MENU resource-definition statement sets the menu for a dialog box. If no statement is given, the dialog box has no menu.

Syntax

MENU menuname

Parameters

menuname
Specifies the menu to use. This value is either the name of the menu or the integer identifier of the menu.

Example

The following example demonstrates the use of the MENU dialog statement:

MENU errmenu


MENUITEM Statement

The MENUITEM resource-definition statement creates a menu item.

Syntax

MENUITEM text, result, [[optionlist]]  MENUITEM SEPARATOR

Parameters

text
A string that indicates the name of the menu item.

The string can contain the escape characters \t and \a. The \t character inserts a tab in the string and is used to align text in columns. Tab characters should be used only in menus, not in menu bars. (For information on menus, see POPUP Resource.) The \a character aligns all text that follows it flush right to the menu bar or pop-up menu.

result
A number that specifies the result generated when the user selects the menu item. This parameter takes an integer value. Menu-item results are always integers; when the user clicks the menu-item name, the result is sent to the window that owns the menu.
optionlist
This parameter specifies the appearance of the menu item. This optional parameter takes one or more redefined menu options, separated by commas or spaces. The menu options are as follows:
Option | Description
CHECKED | Menu item has a check mark next to it.
GRAYED | Menu item is initially inactive and appears on the menu in gray or a lightened shade of the menu-text color. This option cannot be used with the INACTIVE option.
HELP | Identifies a help item.
INACTIVE | Menu item is displayed but it cannot be selected. This option cannot be used with the GRAYED option.
MENUBARBREAK | Same as MENUBREAK except that for pop-up menus, it separates the new column from the old column with a vertical line.
MENUBREAK | Places the menu item on a new line for static menu-bar items. For menus, it places the menu item in a new column with no dividing line between the columns.

SEPARATOR
The MENUITEM SEPARATOR form of the MENUITEM statement creates an inactive menu item that serves as a dividing bar between two active menu items on a menu.

Example

The following example demonstrates the use of the MENUITEM and MENUITEM SEPARATOR statements:

MENUITEM "&Roman", 206, CHECKED, GRAYED
MENUITEM SEPARATOR
MENUITEM "&Blackletter", 301

See Also

MENU, POPUP


STYLE Statement

The STYLE resource-definition statement sets the window style of the dialog box. The window style specifies whether the box is a pop-up or a child window.

Syntax

STYLE style

Parameters

style
Specifies the window style. This parameter takes an integer value or predefined name. The default style is WS_POPUP | WS_BORDER | WS_SYSMENU.

The following is a list of the predefined styles:

Style | Description
DS_LOCALEDIT | Specifies that edit controls in the dialog box will use memory in the application's data section. By default, all edit controls in dialog boxes use memory outside the application's data section. This feature can be suppressed by adding the DS_LOCALEDIT flag to the STYLE command for the dialog box. If this flag is not used, the EM_GETHANDLE and EM_SETHANDLE messages must not be used.
DS_MODALFRAME | Creates a dialog box with a modal dialog box frame that can be combined with a title bar and window menu by specifying the WS_CAPTION and WS_SYSMENU styles.
DS_NOIDLEMSG | Suppresses WM_ENTERIDLE messages that the system would otherwise send to the owner of the dialog box while the dialog box is displayed.
DS_SYSMODAL | Create a dialog box with the WS_EX_TOPMOST flag. This flag cannot be combined with the DS_CONTROL style. This flag is obsolete and is included for compatibility with 16-bit versions of Windows.
WS_BORDER | Creates a window that has a border.
WS_CAPTION | Creates a window that has a title bar (implies the WS_BORDER style).
WS_CHILD | Creates a child window. It cannot be used with the WS_POPUP style.
WS_CHILDWINDOW | Creates a child window that has the WS_CHILD style.
WS_CLIPCHILDREN | Excludes the area occupied by child windows when drawing within the parent window. Used when creating the parent window.
WS_CLIPSIBLINGS | Clips child windows relative to each other; that is, when a particular child window receives a WM_PAINT message, this style clips all other top-level child windows out of the region of the child window to be updated. (If the WS_CLIPSIBLINGS style is not given and child windows overlap, it is possible, when drawing in the client area of a child window, to draw in the client area of a neighboring child window.) For use with the WS_CHILD style only.
WS_DISABLED | Creates a window that is initially disabled.
WS_DLGFRAME | Creates a window with a modal dialog box frame but no title.
WS_GROUP | Specifies the first control of a group of controls in which the user can move from one control to the next by using the arrow keys. All controls defined with the WS_GROUP style after the first control belong to the same group. The next control with the WS_GROUP style ends the style group and starts the next group (that is, one group ends where the next begins). This style is valid only for controls.
WS_HSCROLL | Creates a window that has a horizontal scroll bar.
WS_ICONIC | Creates a window that is initially iconic. For use with the WS_OVERLAPPED style only.
WS_MAXIMIZE | Creates a window of maximum size.
WS_MAXIMIZEBOX | Creates a window that has a maximize button.
WS_MINIMIZE | Creates a window of minimum size.
WS_MINIMIZEBOX | Creates a window that has a minimize button.
WS_OVERLAPPED | Creates an overlapped window. An overlapped window has a caption and a border.
WS_OVERLAPPED
WINDOW 		Creates an overlapped window having the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles.
WS_POPUP | Creates a pop-up window. It cannot be used with the WS_CHILD style.
WS_POPUPWINDOW | Creates a pop-up window that has the WS_POPUP, WS_BORDER, and WS_SYSMENU styles. The WS_CAPTION style must be combined with the WS_POPUPWINDOW style to make the System menu visible.
WS_SIZEBOX | Creates a window that has a size box. Used only for windows with a title bar or with vertical and horizontal scroll bars.
WS_SYSMENU | Creates a window that has a window menu in its title bar. Used only for windows with title bars. If used with a child window, this style creates a close button instead of a window menu.
WS_TABSTOP | Specifies one of any number of controls through which the user can move by using the TAB key. The TAB key moves the user to the next control specified by the WS_TABSTOP style. This style is valid only for controls.
WS_THICKFRAME | Creates a window with a thick frame that can be used to size the window.
WS_VISIBLE | Creates a window that is initially visible. This applies to overlapping and pop-up windows. For overlapping windows, the y parameter is used as a parameter for the ShowWindow function.
WS_VSCROLL | Creates a window that has a vertical scroll bar.

Remarks

If the predefined names are used, you must include WINDOWS.H.

Vu dans ... Masm32/include/Windows.h

                                WS_OVERLAPPED                        equ 0h
                                WS_POPUP                             equ 80000000h
                                WS_CHILD                             equ 40000000h
                                WS_MINIMIZE                          equ 20000000h
                                WS_VISIBLE                           equ 10000000h
                                WS_DISABLED                          equ 8000000h
                                WS_CLIPSIBLINGS                      equ 4000000h
                                WS_CLIPCHILDREN                      equ 2000000h
                                WS_MAXIMIZE                          equ 1000000h
                                WS_CAPTION                           equ 0C00000h
                                WS_BORDER                            equ 800000h
                                WS_DLGFRAME                          equ 400000h
                                WS_VSCROLL                           equ 200000h
                                WS_HSCROLL                           equ 100000h
                                WS_SYSMENU                           equ 80000h
                                WS_THICKFRAME                        equ 40000h
                                WS_GROUP                             equ 20000h
                                WS_TABSTOP                           equ 10000h
                                WS_MINIMIZEBOX                       equ 20000h
                                WS_MAXIMIZEBOX                       equ 10000h
                                WS_TILED                             equ WS_OVERLAPPED
                                WS_ICONIC                            equ WS_MINIMIZE
                                WS_SIZEBOX                           equ WS_THICKFRAME
                                WS_OVERLAPPEDWINDOW                  equ WS_OVERLAPPED OR WS_CAPTION OR WS_SYSMENU OR WS_THICKFRAME OR WS_MINIMIZEBOX OR WS_MAXIMIZEBOX
                                WS_TILEDWINDOW                       equ WS_OVERLAPPEDWINDOW
                                WS_POPUPWINDOW                       equ WS_POPUP OR WS_BORDER OR WS_SYSMENU
                                WS_CHILDWINDOW                       equ WS_CHILD
                                WS_EX_DLGMODALFRAME                  equ 1h
                                WS_EX_NOPARENTNOTIFY                 equ 4h
                                WS_EX_TOPMOST                        equ 8h
                                WS_EX_ACCEPTFILES                    equ 10h
                                WS_EX_TRANSPARENT                    equ 20h
                                WS_EX_MDICHILD                       equ 00000040h
                                WS_EX_TOOLWINDOW                     equ 00000080h
                                WS_EX_WINDOWEDGE                     equ 00000100h
                                WS_EX_CLIENTEDGE                     equ 00000200h
                                WS_EX_CONTEXTHELP                    equ 00000400h
                                WS_EX_RIGHT                          equ 00001000h
                                WS_EX_LEFT                           equ 00000000h
                                WS_EX_RTLREADING                     equ 00002000h
                                WS_EX_LTRREADING                     equ 00000000h
                                WS_EX_LEFTSCROLLBAR                  equ 00004000h
                                WS_EX_RIGHTSCROLLBAR                 equ 00000000h
                                WS_EX_CONTROLPARENT                  equ 00010000h
                                WS_EX_STATICEDGE                     equ 00020000h
                                WS_EX_APPWINDOW                      equ 00040000h
                                WS_EX_OVERLAPPEDWINDOW               equ WS_EX_WINDOWEDGE OR WS_EX_CLIENTEDGE
                                WS_EX_PALETTEWINDOW                  equ WS_EX_WINDOWEDGE OR WS_EX_TOOLWINDOW OR WS_EX_TOPMOST


Preprocessor Directives

You can use the directives described in the following table as needed in your resource script. They instruct RC to perform actions or to assign values to names.

Directive | Description
#define | Defines a specified name by assigning it a given value.
#elif | Marks an optional clause of a conditional-compilation block.
#else | Marks the last optional clause of a conditional-compilation block.
#endif | Marks the end of a conditional-compilation block.
#if | Conditionally compiles the script if a specified expression is true.
#ifdef | Conditionally compiles the script if a specified name is defined.
#ifndef | Conditionally compiles the script if a specified name is not defined.
#include | Copies the contents of a file into the resource-definition file.
#undef | Removes the definition of the specified name.

To define symbols for your resource identifiers, use the #define directive to define them in a header file. Include this header both in the resource script and your application source code. Similarly, you define the values for resource attributes and styles by including WINDOWS.H in the resource script.

RC treats files with the .C and .H extensions in a special manner. It assumes that a file with one of these extensions does not contain resources. If a file has the .C or .H file extension, RC ignores all lines in the file except the preprocessor directives. Therefore, to include a file that contains resources in another resource script, give the file to be included an extension other than .C or .H.


Pragma Directives

RC does not support the pragma directives supported by the C/C++ compiler. However, RC does support the following pragma directive for changing the code page:

#pragma code_page( [ DEFAULT | CodePageNum ] )


Predefined Macros

RC does not support the ANSI C predefined macros (__DATE__, __FILE__, __LINE__, __STDC__, __TIME__, __TIMESTAMP__). Therefore, you cannot include these macros in header files that you will include in your resource script.

RC does define RC_INVOKED, which enables you conditionally compile portions of your header files, depending on whether the compiler is your C compiler or the RC compiler. This is important because the RC compiler supports only a subset of the statements a C compiler would support.

To conditionally compile your code with the RC compiler, surround code that RC cannot compile with #ifndef RC_INVOKED and #endif.

The following example is taken from the SDK samples. It demonstrates how to create a header file that can be compiled conditionally.

#ifndef RC_INVOKED
#pragma message("Including CntrOutl.H from " __FILE__)
#endif


Defining Names for the Preprocessor

You can specify conditional compilation in a script, based on whether a name is defined on the RC command line with the /d option, or in the file or an include file with the #define directive.

For example, suppose your application has a pop-up menu, the Debug menu, that should appear only with debugging versions of the application. When you compile the application for normal use, the Debug menu is not included. The following example shows the statements that can be added to the resource-definition file to define the Debug menu:

MainMenu MENU
{
    . . .
#ifdef DEBUG
    POPUP "&Debug"
    {
        MENUITEM "&Memory usage", ID_MEMORY
        MENUITEM "&Walk data heap", ID_WALK_HEAP
    }
#endif
}

When compiling resources for a debugging version of the application, you could include the Debug menu by using the following command:

rc -d DEBUG myapp.rc

To compile resources for a normal version of the application—one that does not include the Debug menu—you could use the following command:

rc myapp.rc


RC Preprocessor Directives

The following are the RC preprocessor directives.

#define
#elif
#endif
#if
#ifdef
#ifndef
#include
#undef


Preprocessor Operators

RC supports using the standard C preprocessing operators in macro definitions. These operators are described in the following table.

Operator | Description
# | Encloses the argument in double quotes.
#@ | Encloses the argument in single quotes.
## | Concatenates tokens used as arguments to form other tokens.


#include

The #include directive causes resource compiler to process the file specified in the filename parameter. This file should be a header file that defines the constants used in the resource-definition file. The file can use single-byte, double-byte, or Unicode characters.

Use the statement

#ifndef RC_INVOKED

in your header file to surround statements that can be compiled by a C compiler but not RC. This way, you can use the same include files in your .C and .RC files.

Syntax

#include filename

Parameters

filename
Specifies the name of the file to be included. If the file is in the current directory, the string must be enclosed in double quotation marks; if the file is in the directory specified by the INCLUDE environment variable, the string must be enclosed in less-than and greater-than characters (<>). You must give a full path enclosed in double quotation marks (") if the file is not in the current directory or in the directory specified by the INCLUDE environment variable.

Example

This example processes the header files Windows.H and MyDefs.H while compiling the resource-definition file:

#include <windows.h>
#include "headers\mydefs.h"

See Also

#define


#if

The #if directive controls conditional compilation of the resource file by checking the specified constant expression. If the constant expression is nonzero, #if directs the compiler to continue processing statements up to the next #endif, #else, or #elif directive and then skip to the statement after the #endif directive. If the constant expression is zero, #if directs the compiler to skip to the next #endif, #else, or #elif directive.

Syntax

#if constant-expression

Parameters

constant-expression
Specifies the expression to be checked. This value is a defined name, an integer constant, or an expression consisting of names, integers, and arithmetic and relational operators.

Example

This example compiles the BITMAP statement only if the value assigned to the name Version is less than 3:

#if Version < 3
BITMAP 1 errbox.bmp
#endif

See Also

#elif, #else, #endif, #ifdef, #ifndef


#else

The #else directive marks an optional clause of a conditional-compilation block defined by a #ifdef, #ifndef, or #if directive. The #else directive must be the last directive before the #endif directive.

Syntax

#else

Parameters

This directive has no parameters.

Example

This example compiles the second BITMAP statement only if the name DEBUG is not defined:

#ifdef DEBUG
    BITMAP 1 errbox.bmp
#else
    BITMAP 1 userbox.bmp
#endif

See Also

#elif, #endif, #if, #ifdef, #ifndef


#elif

The #elif directive marks an optional clause of a conditional-compilation block defined by a #ifdef, #ifndef, or #if directive. The directive controls conditional compilation of the resource file by checking the specified constant expression. If the constant expression is nonzero, #elif directs the compiler to continue processing statements up to the next #endif, #else, or #elif directive and then skip to the statement after #endif. If the constant expression is zero, #elif directs the compiler to skip to the next #endif, #else, or #elif directive. You can use any number of #elif directives in a conditional block.

Syntax

#elif constant-expression

Parameters

constant-expression
Specifies the expression to be checked. This value is a defined name, an integer constant, or an expression consisting of names, integers, and arithmetic and relational operators.

Example

In this example, #elif directs the compiler to process the second BITMAP statement only if the value assigned to the name Version is less than 7. The #elif directive itself is processed only if Version is greater than or equal to 3.

#if Version < 3
BITMAP 1 errbox.bmp
#elif Version < 7
BITMAP 1 userbox.bmp
#endif

See Also

#else, #endif, #if, #ifdef, #ifndef


#endif

The #endif directive marks the end of a conditional-compilation block defined by a #ifdef directive. One #endif is required for each #if, #ifdef, or #ifndef directive.

Syntax

#endif

Parameters

This directive has no parameters.

See Also

#elif, #else, #if, #ifdef, #ifndef


#define

The #define directive assigns the given value to the specified name. All subsequent occurrences of the name are replaced by the value.

Syntax

#define name value

Parameters

name
Specifies the name to be defined. This value is any combination of letters, digits, and punctuation.
value
Specifies any integer, character string, or line of text.

Example

This example assigns values to the names NONZERO and USERCLASS:

#define     NONZERO     1
#define     USERCLASS   "MyControlClass"

See Also

#ifdef, #ifndef, #undef


#ifdef

The #ifdef directive controls conditional compilation of the resource file by checking the specified name. If the name has been defined by using a #define directive or by using the /d command-line option with the resource compiler, #ifdef directs the compiler to continue with the statement immediately after the #ifdef directive. If the name has not been defined, #ifdef directs the compiler to skip all statements up to the next #endif directive.

Syntax

#ifdef name

Parameters

name
Specifies the name to be checked by the directive.

Example

This example compiles the BITMAP statement only if the name Debug is defined:

#ifdef Debug
BITMAP 1 errbox.bmp
#endif

See Also

#define, #endif, #if, #ifndef, #undef


#ifndef

The #ifndef directive controls conditional compilation of the resource file by checking the specified name. If the name has not been defined or if its definition has been removed by using the #undef directive, #ifndef directs the compiler to continue processing statements up to the next #endif, #else, or #elif directive and then skip to the statement after the #endif directive. If the name is defined, #ifndef directs the compiler to skip to the next #endif, #else, or #elif directive.

Syntax

#ifndef name

Parameters

name
Specifies the name to be checked by the directive.

Example

This example compiles the BITMAP statement only if the name Optimize is not defined:

#ifndef Optimize
BITMAP 1 errbox.bmp
#endif

See Also

#elif, #else, #endif, #if, #ifdef, #undef


#undef

The #undef directive removes the current definition of the specified name. All subsequent occurrences of the name are processed without replacement.

Syntax

#undef name

Parameters

name
Specifies the name to be removed. This value is any combination of letters, digits, and punctuation.

Example

This example removes the definitions for the names nonzero and USERCLASS:

#undef     nonzero
#undef     USERCLASS

See Also

#define


Accueil

Accueil CHM


Renaming the Compiled Resource File

By default, when compiling resources, RC names the compiled resource (.RES) file with the base name of the .RC file and places it in the same directory as the .RC file. CVTRES must then be invoked to convert the .RES file to a binary resource (.RBJ) format which can be understood by the linker. The following example compiles MYAPP.RC and creates a compiled resource file named MYAPP.RES in the same directory as MYAPP.RC:

rc myapp.rc

The /fo option gives the resulting .RES file a name that differs from the name of the corresponding .RC file. For example, to name the resulting .RES file NEWFILE.RES, use the following command:

rc -fo newfile.res myapp.rc

The /fo option can also place the .RES file in a different directory. For example, the following command places the compiled resource file MYAPP.RES in the directory C:\SOURCE\RESOURCE:

rc -fo c:\source\resource\myapp.res myapp.rc


About the Resource Compiler

To include resources in your Win32-based application with RC, do the following:

  1. Create individual files for your cursors, icons, bitmaps, dialog boxes, and fonts. To do this, you can use the Dialog Editor, Image Editor, and Font Editor included with the Platform SDK, or equivalent developer tools.
  2. Create a resource-definition script (.RC file) that describes the resources used by your application. For more information, see Creating a Resource-Definition File.
  3. Compile the script with RC. For more information, see Using RC (The RC Command Line).
  4. Link the compiled resource (.RES) file into the application's executable file with your linker.


Resource Compiler Reference

The resource compiler reference consists of the following sections:

  • RC Resource-Definition Statements
  • RC Preprocessor Directives
  • RC Diagnostic Messages


Using the Resource Compiler

The Microsoft® Windows® Resource Compiler (RC) is a tool used in building Win32®-based applications. This overview describes how to create a resource-definition (script) file, how to compile your application's resources, and how to add compiled resources to your application.


Using RC (The RC Command Line)

To start RC, use the RC command.

Syntax

RC [options] script-file

The script-file parameter specifies the name of the resource-definition file that contains the names, types, filenames, and descriptions of the resources to be compiled. The options parameter can be one or more of the command-line options described in Parameters.

Parameters

/?
Displays a list of RC command-line options.
/d
Defines a symbol for the preprocessor that you can test with the #ifdef directive.
/fo resname
Uses resname for the name of the .RES file.
/h
Displays a list of RC command-line options.
/i
Searches the specified directory before searching the directories specified by the INCLUDE environment variable.
/l codepage
Specifies default language for compilation. For example, -l409 is equivalent to including the following statement at the top of the resource script file:
LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US

Alternatively, you use #pragma code_page(409) in the .RC file.

/n
Null terminates all strings in the string table.
/r
Ignored. Provided for compatibility with existing makefiles.
/u
Undefines a symbol for the preprocessor.
/v
Displays messages that report on the progress of the compiler.
/x
Prevents RC from checking the INCLUDE environment variable when searching for header files or resource files.

Remarks

Options are not case sensitive, and a hyphen (-) can be used in place of a slash mark (/). You can combine single-letter options if they do not require any additional parameters. For example, the following two commands are equivalent:

rc /V /X SAMPLE.RC
rc -vx sample.rc

For examples using RC, see the following topics:

  • Defining Names for the Preprocessor
  • Renaming the Compiled Resource File
  • Searching for Files
  • Displaying Progress Messages


Displaying Progress Messages

By default, RC compiles without displaying progress messages. However, you can specify that RC is to display progress messages. To do so, use the /v option.

The following example causes RC to report its progress as it compiles the resource-definition file SAMPLE.RC and creates the compiled resource file SAMPLE.RES:

rc /v sample.rc


RC Diagnostic Messages

This section describes of diagnostic messages produced by RC. Many of these messages appear when RC is not able to compile resources properly. The descriptions clarify the cause of each message.

A capital V in parentheses (V) at the beginning of a message description indicates that the message is displayed only if RC is run with the /v (verbose) option. These messages are generally informative and do not necessarily indicate errors.

The messages are listed in alphabetic order.

A
B
C
E
F
I
N
O
R
T
U
V
W


Searching for Files

By default, RC searches for header files and resource files (such as icon and cursor files) first in the current directory and then in the directories specified by the INCLUDE environment variable. (The PATH environment variable has no effect on which directories RC searches.)

Adding a Directory to Search

You can use the /i option to add a directory to the list of directories RC searches. The compiler then searches the directories in the following order:

  1. The current directory
  2. The directory or directories you specify by using the /i option, in the order in which they appear on the RC command line
  3. The list of directories specified by the INCLUDE environment variable, in the order in which the variable lists them, unless you specify the /x option

The following example compiles the resource-definition file MYAPP.RC:

rc /i c:\source\stuff /i d:\resources myapp.rc

When compiling the script MYAPP.RC, RC searches for header files and resource files first in the current directory, then in C:\SOURCE\STUFF and D:\RESOURCES, and then in the directories specified by the INCLUDE environment variable.

Ignoring the INCLUDE Environment Variable

You can prevent RC from using the INCLUDE environment variable when determining the directories to search. To do so, use the /x option. The compiler then searches for files only in the current directory and in any directories you specify by using the /i option.

The following command compiles the script file MYAPP.RC:

rc /x /i c:\source\stuff myapp.rc

When compiling the script MYAPP.RC, RC searches for header files and resource files first in the current directory and then in C:\SOURCE\STUFF. It does not search the directories specified by the INCLUDE environment variable.


Exemple

Microsoft (R) Windows Resource To Object Converter Version 8.00.50727.1433
Copyright (C) Microsoft Corporation. All rights reserved.

usage: CVTRES [options] [files]

options:

/DEFINE:symbol
/MACHINE:{ARM|EBC|IA64|IPS|MIPS16|MIPSFPU|MIPSFPU16|SH4|THUMB|X64|X86}
/NOLOGO
/OUT:filename
/READONLY
/VERBOSE
/WINDOWSCE[:{CONVERT|EMULATION}]

--- Exemple du fichier builde--res.BAT --- Builder file.RES et file.OBJ ---

@echo off
\masm32\bin\rc /v Main_A.rc
\masm32\bin\cvtres /machine:ix86 Main_A.res
pause


VarFileInfo Block

A variable information block has the following form:

BLOCK "VarFileInfo"  {      VALUE "Translation",          langID, charsetID              . . .  }

Parameters

langID
Specifies one of the language identifiers specified in the Remarks section.
charsetID
Specifies one of the character-set identifiers specified in the Remarks section.

Remarks

More than one identifier pair can be given, but each pair must be separated from the preceding pair with a comma.

The langID parameter specifies one of the following language codes:

Code | Language | Code | Language
0x0401 | Arabic | 0x0415 | Polish
0x0402 | Bulgarian | 0x0416 | Brazilian Portuguese
0x0403 | Catalan | 0x0417 | Rhaeto-Romanic
0x0404 | Traditional Chinese | 0x0418 | Romanian
0x0405 | Czech | 0x0419 | Russian
0x0406 | Danish | 0x041A | Croato-Serbian (Latin)
0x0407 | German | 0x041B | Slovak
0x0408 | Greek | 0x041C | Albanian
0x0409 | U.S. English | 0x041D | Swedish
0x040A | Castilian Spanish | 0x041E | Thai
0x040B | Finnish | 0x041F | Turkish
0x040C | French | 0x0420 | Urdu
0x040D | Hebrew | 0x0421 | Bahasa
0x040E | Hungarian | 0x0804 | Simplified Chinese
0x040F | Icelandic | 0x0807 | Swiss German
0x0410 | Italian | 0x0809 | U.K. English
0x0411 | Japanese | 0x080A | Mexican Spanish
0x0412 | Korean | 0x080C | Belgian French
0x0413 | Dutch | 0x0C0C | Canadian French
0x0414 | Norwegian – Bokml | 0x100C | Swiss French
0x0810 | Swiss Italian | 0x0816 | Portuguese
0x0813 | Belgian Dutch | 0x081A | Serbo-Croatian (Cyrillic)
0x0814 | Norwegian – Nynorsk |  |

The charsetID parameter specifies one of the following character-set identifiers:

Identifier | Character Set
0 | 7-bit ASCII
932 | Japan (Shift – JIS X-0208)
949 | Korea (Shift – KSC 5601)
950 | Taiwan (Big5)
1200 | Unicode
1250 | Latin-2 (Eastern European)
1251 | Cyrillic
1252 | Multilingual
1253 | Greek
1254 | Turkish
1255 | Hebrew
1256 | Arabic


VERSION Statement

The VERSION resource-definition statement specifies version information about a resource that can be used by tools that read and write resource files. The specified dword value appears with the resource in the compiled .RES file. However, the value is not stored in the executable file and has no significance to the system.

The VERSION statement appears before the beginning of the body of an ACCELERATORS, DIALOG, MENU, RCDATA, or STRINGTABLE resource definition. The specified value applies only to that resource.

Syntax

VERSION dword

Parameters

dword
A user-defined DWORD value.

See Also

ACCELERATORS, CHARACTERISTICS, DIALOG, LANGUAGE, MENU, RCDATA, STRINGTABLE


VERSIONINFO Resource

The VERSIONINFO resource-definition statement creates a version-information resource. The resource contains such information about the file as its version number, its intended operating system, and its original filename. The resource is intended to be used with the File Installation library functions.

Syntax

versionID VERSIONINFO fixed-info  {      block-statement      . . .  }

Parameters

versionID
Specifies the version-information resource identifier. This value must be 1.
fixed-info
Specifies the version information, such as the file version and the intended operating system. This parameter consists of the following statements:
Statement | Description
FILEVERSION
version 		Specifies the binary version number for the file. The version consists of two 32-bit integers, defined by four 16-bit integers. For example, "FILEVERSION 3,10,0,61" is translated into two doublewords: 0x0003000a and 0x0000003d, in that order. Therefore, if version is defined by the DWORD values dw1 and dw2, they need to appear in the FILEVERSION statement as follows: HIWORD(dw1), LOWORD(dw1), HIWORD(dw2), LOWORD(dw2).
PRODUCTVERSION
version 		Specifies the binary version number for the product with which the file is distributed. The version parameter is two 32-bit integers, defined by four 16-bit integers. For more information about version, see the FILEVERSION description.
FILEFLAGSMASK
fileflagsmask 		Specifies which bits in the FILEFLAGS statement are valid. If a bit is set, the corresponding bit in FILEFLAGS is valid.
FILEFLAGS fileflags | Specifies the Boolean attributes of the file. The fileflags parameter must be the combination of all the file flags that are valid at compile time. For 16-bit Windows, this value is 0x3f.
FILEOS fileos | Specifies the operating system for which this file was designed. The fileos parameter can be one of the operating system values given in the Remarks section.
FILETYPE filetype | Specifies the general type of file. The filetype parameter can be one of the file type values listed in the Remarks section.
FILESUBTYPE
subtype 		Specifies the function of the file. The subtype parameter is zero unless the type parameter in the FILETYPE statement is VFT_DRV, VFT_FONT, or VFT_VXD. For a list of file subtype values, see the Remarks section.

block-statement
Specifies one or more version-information blocks. A block can contain string information or variable information. For more information, see StringFileInfo Block or VarFileInfo Block.

Remarks

To use the constants specified with the VERSIONINFO statement, the WINVER.H file (included in WINDOWS.H) must be included in the resource-definition file.

The following list describes the parameters used in the VERSIONINFO statement:

fileflags
Specifies a combination of the following values:
Value | Description
VS_FF_DEBUG | File contains debugging information or is compiled with debugging features enabled.
VS_FF_PATCHED | File has been modified and is not identical to the original shipping file of the same version number.
VS_FF_PRERELEASE | File is a development version, not a commercially released product.
VS_FF_PRIVATEBUILD | File was not built using standard release procedures. If this value is given, the StringFileInfo block must contain a PrivateBuild string.
VS_FF_SPECIALBUILD | File was built by the original company using standard release procedures but is a variation of the standard file of the same version number. If this value is given, the StringFileInfo block must contain a SpecialBuild string.

fileos
Specifies one of the following values:
Value | Description
VOS_UNKNOWN | The operating system for which the file was designed is unknown.
VOS_DOS | File was designed for MS-DOS.
VOS_NT | File was designed for Windows NT.
VOS_WINDOWS16 | File was designed for 16-bit Windows.
VOS_WINDOWS32 | File was designed for 32-bit Windows.
VOS_DOS_WINDOWS16 | File was designed for 16-bit Windows running with MS-DOS.
VOS_DOS_WINDOWS32 | File was designed for 32-bit Windows running with MS-DOS.
VOS_NT_WINDOWS32 | File was designed for 32-bit Windows running with Windows NT.

The values 0x00002L, 0x00003L, 0x20000L and 0x30000L are reserved.

filetype
Specifies one of the following values:
Value | Description
VFT_UNKNOWN | File type is unknown.
VFT_APP | File contains an application.
VFT_DLL | File contains a dynamic-link library (DLL).
VFT_DRV | File contains a device driver. If filetype is VFT_DRV, subtype contains a more specific description of the driver.
VFT_FONT | File contains a font. If filetype is VFT_FONT, subtype contains a more specific description of the font.
VFT_VXD | File contains a virtual device.
VFT_STATIC_LIB | File contains a static-link library.

All other values are reserved for use by Microsoft.

subtype
Specifies additional information about the file type.

If filetype specifies VFT_DRV, this parameter can be one of the following values:
Value | Description
VFT2_UNKNOWN | Driver type is unknown.
VFT2_DRV_COMM | File contains a communications driver.
VFT2_DRV_PRINTER | File contains a printer driver.
VFT2_DRV_KEYBOARD | File contains a keyboard driver.
VFT2_DRV_LANGUAGE | File contains a language driver.
VFT2_DRV_DISPLAY | File contains a display driver.
VFT2_DRV_MOUSE | File contains a mouse driver.
VFT2_DRV_NETWORK | File contains a network driver.
VFT2_DRV_SYSTEM | File contains a system driver.
VFT2_DRV_INSTALLABLE | File contains an installable driver.
VFT2_DRV_SOUND | File contains a sound driver.

If filetype specifies VFT_FONT, this parameter can be one of the following values:
Value | Description
VFT2_UNKNOWN | Font type is unknown.
VFT2_FONT_RASTER | File contains a raster font.
VFT2_FONT_VECTOR | File contains a vector font.
VFT2_FONT_TRUETYPE | File contains a TrueType font.

If filetype specifies VFT_VXD, this parameter must be the virtual-device identifier included in the virtual-device control block.

All subtype values not listed here are reserved for use by Microsoft.

langID
Specifies one of the following language codes:
Code | Language | Code | Language
0x0401 | Arabic | 0x0415 | Polish
0x0402 | Bulgarian | 0x0416 | Brazilian Portuguese
0x0403 | Catalan | 0x0417 | Rhaeto-Romanic
0x0404 | Traditional Chinese | 0x0418 | Romanian
0x0405 | Czech | 0x0419 | Russian
0x0406 | Danish | 0x041A | Croato-Serbian (Latin)
0x0407 | German | 0x041B | Slovak
0x0408 | Greek | 0x041C | Albanian
0x0409 | U.S. English | 0x041D | Swedish
0x040A | Castilian Spanish | 0x041E | Thai
0x040B | Finnish | 0x041F | Turkish
0x040C | French | 0x0420 | Urdu
0x040D | Hebrew | 0x0421 | Bahasa
0x040E | Hungarian | 0x0804 | Simplified Chinese
0x040F | Icelandic | 0x0807 | Swiss German
0x0410 | Italian | 0x0809 | U.K. English
0x0411 | Japanese | 0x080A | Mexican Spanish
0x0412 | Korean | 0x080C | Belgian French
0x0413 | Dutch | 0x0C0C | Canadian French
0x0414 | Norwegian – Bokml | 0x100C | Swiss French
0x0810 | Swiss Italian | 0x0816 | Portuguese
0x0813 | Belgian Dutch | 0x081A | Serbo-Croatian (Cyrillic)
0x0814 | Norwegian – Nynorsk

charsetID
Specifies one of the following character-set identifiers:
Identifier | Character Set
0 | 7-bit ASCII
932 | Japan (Shift – JIS X-0208)
949 | Korea (Shift – KSC 5601)
950 | Taiwan (Big5)
1200 | Unicode
1250 | Latin-2 (Eastern European)
1251 | Cyrillic
1252 | Multilingual
1253 | Greek
1254 | Turkish
1255 | Hebrew
1256 | Arabic

string-name
Specifies one of the following predefined names:

Name | Description
Comments | Specifies additional information that should be displayed for diagnostic purposes.
CompanyName | Specifies the company that produced the file—for example, "Microsoft Corporation" or "Standard Microsystems Corporation, Inc." This string is required.
FileDescription | Specifies a file description to be presented to users. This string may be displayed in a list box when the user is choosing files to install—for example, "Keyboard Driver for AT-Style Keyboards". This string is required.
FileVersion | Specifies the version number of the file—for example, "3.10" or "5.00.RC2". This string is required.
InternalName | Specifies the internal name of the file, if one exists—for example, a module name if the file is a dynamic-link library. If the file has no internal name, this string should be the original filename, without extension. This string is required.
LegalCopyright | Specifies all copyright notices that apply to the file. This should include the full text of all notices, legal symbols, copyright dates, and so on—for example, "Copyright© Microsoft Corporation 1990–1998". This string is optional.
LegalTrademarks | Specifies all trademarks and registered trademarks that apply to the file. This should include the full text of all notices, legal symbols, trademark numbers, and so on. This string is optional.
OriginalFilename | Specifies the original name of the file, not including a path. This information enables an application to determine whether a file has been renamed by a user. The format of the name depends on the file system for which the file was created. This string is required.
PrivateBuild | Specifies information about a private version of the file—for example, "Built by TESTER1 on \TESTBED". This string should be present only if VS_FF_PRIVATEBUILD is specified in the fileflags parameter of the root block.
ProductName | Specifies the name of the product with which the file is distributed. This string is required.
ProductVersion | Specifies the version of the product with which the file is distributed—for example, "3.10" or "5.00.RC2". This string is required.
SpecialBuild | Specifies how this version of the file differs from the standard version—for example, "Private build for TESTER1 solving mouse problems on M250 and M250E computers". This string should be present only if VS_FF_SPECIALBUILD is specified in the fileflags parameter of the root block.


StringFileInfo Block

A string information block has the following form:

BLOCK "StringFileInfo"  {       BLOCK "lang-charset"      {          VALUE "string-name", "value"              . . .      }  }

Parameters

lang-charset
Specifies a language and character-set identifier pair. It is a hexadecimal string consisting of the concatenation of the language and character-set identifiers specified in the Remarks section.
string-name
Specifies the name of a value in the block and can be one of the predefined names specified in the Remarks section.
value
Specifies, as a character string, the value of the corresponding string name. More than one VALUE statement can be given.

Remarks

The lang-charset parameter specifies one of the following language codes:

Code | Language | Code | Language
0x0401 | Arabic | 0x0415 | Polish
0x0402 | Bulgarian | 0x0416 | Brazilian Portuguese
0x0403 | Catalan | 0x0417 | Rhaeto-Romanic
0x0404 | Traditional Chinese | 0x0418 | Romanian
0x0405 | Czech | 0x0419 | Russian
0x0406 | Danish | 0x041A | Croato-Serbian (Latin)
0x0407 | German | 0x041B | Slovak
0x0408 | Greek | 0x041C | Albanian
0x0409 | U.S. English | 0x041D | Swedish
0x040A | Castilian Spanish | 0x041E | Thai
0x040B | Finnish | 0x041F | Turkish
0x040C | French | 0x0420 | Urdu
0x040D | Hebrew | 0x0421 | Bahasa
0x040E | Hungarian | 0x0804 | Simplified Chinese
0x040F | Icelandic | 0x0807 | Swiss German
0x0410 | Italian | 0x0809 | U.K. English
0x0411 | Japanese | 0x080A | Mexican Spanish
0x0412 | Korean | 0x080C | Belgian French
0x0413 | Dutch | 0x0C0C | Canadian French
0x0414 | Norwegian – Bokml | 0x100C | Swiss French
0x0810 | Swiss Italian | 0x0816 | Portuguese
0x0813 | Belgian Dutch | 0x081A | Serbo-Croatian (Cyrillic)
0x0814 | Norwegian – Nynorsk |  |

The lang-charset parameter also specifies one of the following character-set identifiers:

Identifier | Character Set
0 | 7-bit ASCII
932 | Japan (Shift – JIS X-0208)
949 | Korea (Shift – KSC 5601)
950 | Taiwan (Big5)
1200 | Unicode
1250 | Latin-2 (Eastern European)
1251 | Cyrillic
1252 | Multilingual
1253 | Greek
1254 | Turkish
1255 | Hebrew
1256 | Arabic

The string-name parameter specifies one of the following predefined names:

Name | Description
Comments | Specifies additional information that should be displayed for diagnostic purposes.
CompanyName | Specifies the company that produced the file—for example, "Microsoft Corporation" or "Standard Microsystems Corporation, Inc." This string is required.
FileDescription | Specifies a file description to be presented to users. This string may be displayed in a list box when the user is choosing files to install—for example, "Keyboard Driver for AT-Style Keyboards". This string is required.
FileVersion | Specifies the version number of the file—for example, "3.10" or "5.00.RC2". This string is required.
InternalName | Specifies the internal name of the file, if one exists—for example, a module name if the file is a dynamic-link library. If the file has no internal name, this string should be the original filename, without extension. This string is required.
LegalCopyright | Specifies all copyright notices that apply to the file. This should include the full text of all notices, legal symbols, copyright dates, and so on—for example, "Copyright© Microsoft Corporation 1990–1998". This string is optional.
LegalTrademarks | Specifies all trademarks and registered trademarks that apply to the file. This should include the full text of all notices, legal symbols, trademark numbers, and so on. This string is optional.
OriginalFilename | Specifies the original name of the file, not including a path. This information enables an application to determine whether a file has been renamed by a user. The format of the name depends on the file system for which the file was created. This string is required.
PrivateBuild | Specifies information about a private version of the file—for example, "Built by TESTER1 on \TESTBED". This string should be present only if VS_FF_PRIVATEBUILD is specified in the fileflags parameter of the root block.
ProductName | Specifies the name of the product with which the file is distributed. This string is required.
ProductVersion | Specifies the version of the product with which the file is distributed—for example, "3.10" or "5.00.RC2". This string is required.
SpecialBuild | Specifies how this version of the file differs from the standard version—for example, "Private build for TESTER1 solving mouse problems on M250 and M250E computers". This string should be present only if VS_FF_SPECIALBUILD is specified in the fileflags parameter of the root block.


Resource Compiler Header File

/* -------------------- Resource Compiler Header File ----------------------

   This file supplies the constants used by the resource compiler for
          various 32 bit resource components in .RC script files.

---------------------------------------------------------------------------*/

#define WM_DDE_FIRST        0x03E0
#define WM_DDE_INITIATE   (W M_DDE_FIRST)
#define WM_DDE_TERMINATE  (WM_DDE_FIRST+1)
#define WM_DDE_ADVISE     (WM_DDE_FIRST+2)
#define WM_DDE_UNADVISE   (WM_DDE_FIRST+3)
#define WM_DDE_ACK        (WM_DDE_FIRST+4)
#define WM_DDE_DATA       (WM_DDE_FIRST+5)
#define WM_DDE_REQUEST    (WM_DDE_FIRST+6)
#define WM_DDE_POKE       (WM_DDE_FIRST+7)
#define WM_DDE_EXECUTE    (WM_DDE_FIRST+8)
#define WM_DDE_LAST       (WM_DDE_FIRST+8)

#define HDS_HORZ            0x0000
#define HDS_BUTTONS         0x0002
#define HDS_HOTTRACK        0x0004
#define HDS_HIDDEN          0x0008
#define HDS_DRAGDROP        0x0040
#define HDS_FULLDRAG        0x0080
#define RBS_TOOLTIPS        0x0100
#define RBS_VARHEIGHT       0x0200
#define RBS_BANDBORDERS     0x0400
#define RBS_FIXEDORDER      0x0800
#define RBS_REGISTERDROP    0x1000
#define RBS_AUTOSIZE        0x2000
#define RBS_VERTICALGRIPPER 0x4000
#define RBS_DBLCLKTOGGLE    0x8000

#define TTS_ALWAYSTIP         0x01
#define TTS_NOPREFIX          0x02

#define SBARS_SIZEGRIP      0x0100

#define TBS_AUTOTICKS       0x0001
#define TBS_VERT            0x0002
#define TBS_HORZ            0x0000
#define TBS_TOP             0x0004
#define TBS_BOTTOM          0x0000
#define TBS_LEFT            0x0004
#define TBS_RIGHT           0x0000
#define TBS_BOTH            0x0008
#define TBS_NOTICKS         0x0010
#define TBS_ENABLESELRANGE  0x0020
#define TBS_FIXEDLENGTH     0x0040
#define TBS_NOTHUMB         0x0080
#define TBS_TOOLTIPS        0x0100

#define UDS_WRAP            0x0001
#define UDS_SETBUDDYINT     0x0002
#define UDS_ALIGNRIGHT      0x0004
#define UDS_ALIGNLEFT       0x0008
#define UDS_AUTOBUDDY       0x0010
#define UDS_ARROWKEYS       0x0020
#define UDS_HORZ            0x0040
#define UDS_NOTHOUSANDS     0x0080
#define UDS_HOTTRACK        0x0100

#define PBS_SMOOTH            0x01
#define PBS_VERTICAL          0x04

/* --------------------- Common Control Styles ------------------------- */

#define CCS_TOP             0x00000001L
#define CCS_NOMOVEY         0x00000002L
#define CCS_BOTTOM          0x00000003L
#define CCS_NORESIZE        0x00000004L
#define CCS_NOPARENTALIGN   0x00000008L
#define CCS_ADJUSTABLE      0x00000020L
#define CCS_NODIVIDER       0x00000040L
#define CCS_VERT            0x00000080L
#define CCS_LEFT            (CCS_VERT | CCS_TOP)
#define CCS_RIGHT           (CCS_VERT | CCS_BOTTOM)
#define CCS_NOMOVEX         (CCS_VERT | CCS_NOMOVEY)

#define LVS_ICON            0x0000
#define LVS_REPORT          0x0001
#define LVS_SMALLICON       0x0002
#define LVS_LIST            0x0003
#define LVS_TYPEMASK        0x0003
#define LVS_SINGLESEL       0x0004
#define LVS_SHOWSELALWAYS   0x0008
#define LVS_SORTASCENDING   0x0010
#define LVS_SORTDESCENDING  0x0020
#define LVS_SHAREIMAGELISTS 0x0040
#define LVS_NOLABELWRAP     0x0080
#define LVS_AUTOARRANGE     0x0100
#define LVS_EDITLABELS      0x0200
#define LVS_OWNERDATA       0x1000
#define LVS_NOSCROLL        0x2000
#define LVS_TYPESTYLEMASK   0xfc00
#define LVS_ALIGNTOP        0x0000
#define LVS_ALIGNLEFT       0x0800
#define LVS_ALIGNMASK       0x0c00
#define LVS_OWNERDRAWFIXED  0x0400
#define LVS_NOCOLUMNHEADER  0x4000
#define LVS_NOSORTHEADER    0x8000
#define TVS_HASBUTTONS      0x0001
#define TVS_HASLINES        0x0002
#define TVS_LINESATROOT     0x0004
#define TVS_EDITLABELS      0x0008
#define TVS_DISABLEDRAGDROP 0x0010
#define TVS_SHOWSELALWAYS   0x0020
#define TVS_RTLREADING      0x0040
#define TVS_NOTOOLTIPS      0x0080
#define TVS_CHECKBOXES      0x0100
#define TVS_TRACKSELECT     0x0200
#define TVS_SINGLEEXPAND    0x0400
#define TVS_INFOTIP         0x0800
#define TVS_FULLROWSELECT   0x1000
#define TVS_NOSCROLL        0x2000
#define TVS_NONEVENHEIGHT   0x4000

#define TCS_SCROLLOPPOSITE  0x0001
#define TCS_BOTTOM          0x0002
#define TCS_RIGHT           0x0002
#define TCS_MULTISELECT     0x0004
#define TCS_FLATBUTTONS     0x0008
#define TCS_FORCEICONLEFT   0x0010
#define TCS_FORCELABELLEFT  0x0020
#define TCS_HOTTRACK        0x0040
#define TCS_VERTICAL        0x0080
#define TCS_TABS            0x0000
#define TCS_BUTTONS         0x0100
#define TCS_SINGLELINE      0x0000
#define TCS_MULTILINE       0x0200
#define TCS_RIGHTJUSTIFY    0x0000
#define TCS_FIXEDWIDTH      0x0400
#define TCS_RAGGEDRIGHT     0x0800
#define TCS_FOCUSONBUTTONDOWN 0x1000
#define TCS_OWNERDRAWFIXED  0x2000
#define TCS_TOOLTIPS        0x4000
#define TCS_FOCUSNEVER      0x8000

#define ACS_CENTER          0x0001
#define ACS_TRANSPARENT     0x0002
#define ACS_AUTOPLAY        0x0004
#define ACS_TIMER           0x0008

#define DTS_UPDOWN          0x0001
#define DTS_SHOWNONE        0x0002
#define DTS_SHORTDATEFORMAT 0x0000
#define DTS_LONGDATEFORMAT  0x0004
#define DTS_TIMEFORMAT      0x0009
#define DTS_APPCANPARSE     0x0010
#define DTS_RIGHTALIGN      0x0020

#define PGS_VERT            0x00000000
#define PGS_HORZ            0x00000001
#define PGS_AUTOSCROLL      0x00000002
#define PGS_DRAGNDROP       0x00000004

/*- style definition */

#define NFS_EDIT            0x0001
#define NFS_STATIC          0x0002
#define NFS_LISTCOMBO       0x0004
#define NFS_BUTTON          0x0008
#define NFS_ALL             0x0010

/*- ShowWindow() Commands */

#define SW_HIDE             0
#define SW_SHOWNORMAL       1
#define SW_NORMAL           1
#define SW_SHOWMINIMIZED    2
#define SW_SHOWMAXIMIZED    3
#define SW_MAXIMIZE         3
#define SW_SHOWNOACTIVATE   4
#define SW_SHOW             5
#define SW_MINIMIZE         6
#define SW_SHOWMINNOACTIVE  7
#define SW_SHOWNA           8
#define SW_RESTORE          9
#define SW_SHOWDEFAULT      10
#define SW_FORCEMINIMIZE    11
#define SW_MAX              11

/*
 * Old ShowWindow() Commands
 */
#define HIDE_WINDOW         0
#define SHOW_OPENWINDOW     1
#define SHOW_ICONWINDOW     2
#define SHOW_FULLSCREEN     3
#define SHOW_OPENNOACTIVATE 4

/*
 * Identifiers for the WM_SHOWWINDOW message
 */
#define SW_PARENTCLOSING    1
#define SW_OTHERZOOM        2
#define SW_PARENTOPENING    3
#define SW_OTHERUNZOOM      4

/*
 * Virtual Keys, Standard Set
 */
#define VK_LBUTTON    0x01
#define VK_RBUTTON    0x02
#define VK_CANCEL     0x03
#define VK_MBUTTON    0x04

#define VK_BACK       0x08
#define VK_TAB        0x09

#define VK_CLEAR      0x0C
#define VK_RETURN     0x0D

#define VK_SHIFT      0x10
#define VK_CONTROL    0x11
#define VK_MENU       0x12
#define VK_PAUSE      0x13
#define VK_CAPITAL    0x14

#define VK_KANA       0x15
#define VK_HANGEUL    0x15
#define VK_HANGUL     0x15
#define VK_JUNJA      0x17
#define VK_FINAL      0x18
#define VK_HANJA      0x19
#define VK_KANJI      0x19

#define VK_ESCAPE     0x1B

#define VK_CONVERT    0x1C
#define VK_NONCONVERT 0x1D
#define VK_ACCEPT     0x1E
#define VK_MODECHANGE 0x1F

#define VK_SPACE      0x20
#define VK_PRIOR      0x21
#define VK_NEXT       0x22
#define VK_END        0x23
#define VK_HOME       0x24
#define VK_LEFT       0x25
#define VK_UP         0x26
#define VK_RIGHT      0x27
#define VK_DOWN       0x28
#define VK_SELECT     0x29
#define VK_PRINT      0x2A
#define VK_EXECUTE    0x2B
#define VK_SNAPSHOT   0x2C
#define VK_INSERT     0x2D
#define VK_DELETE     0x2E
#define VK_HELP       0x2F

/* VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) */
/* VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A) */

#define VK_LWIN       0x5B
#define VK_RWIN       0x5C
#define VK_APPS       0x5D

#define VK_NUMPAD0    0x60
#define VK_NUMPAD1    0x61
#define VK_NUMPAD2    0x62
#define VK_NUMPAD3    0x63
#define VK_NUMPAD4    0x64
#define VK_NUMPAD5    0x65
#define VK_NUMPAD6    0x66
#define VK_NUMPAD7    0x67
#define VK_NUMPAD8    0x68
#define VK_NUMPAD9    0x69
#define VK_MULTIPLY   0x6A
#define VK_ADD        0x6B
#define VK_SEPARATOR  0x6C
#define VK_SUBTRACT   0x6D
#define VK_DECIMAL    0x6E
#define VK_DIVIDE     0x6F
#define VK_F1         0x70
#define VK_F2         0x71
#define VK_F3         0x72
#define VK_F4         0x73
#define VK_F5         0x74
#define VK_F6         0x75
#define VK_F7         0x76
#define VK_F8         0x77
#define VK_F9         0x78
#define VK_F10        0x79
#define VK_F11        0x7A
#define VK_F12        0x7B
#define VK_F13        0x7C
#define VK_F14        0x7D
#define VK_F15        0x7E
#define VK_F16        0x7F
#define VK_F17        0x80
#define VK_F18        0x81
#define VK_F19        0x82
#define VK_F20        0x83
#define VK_F21        0x84
#define VK_F22        0x85
#define VK_F23        0x86
#define VK_F24        0x87
#define VK_NUMLOCK    0x90
#define VK_SCROLL     0x91
#define VK_LSHIFT     0xA0
#define VK_RSHIFT     0xA1
#define VK_LCONTROL   0xA2
#define VK_RCONTROL   0xA3
#define VK_LMENU      0xA4
#define VK_RMENU      0xA5

#define VK_PROCESSKEY 0xE5
#define VK_ATTN       0xF6
#define VK_CRSEL      0xF7
#define VK_EXSEL      0xF8
#define VK_EREOF      0xF9
#define VK_PLAY       0xFA
#define VK_ZOOM       0xFB
#define VK_NONAME     0xFC
#define VK_PA1        0xFD
#define VK_OEM_CLEAR  0xFE

#define WM_NULL       0x0000
#define WM_CREATE     0x0001
#define WM_DESTROY    0x0002
#define WM_MOVE       0x0003
#define WM_SIZE       0x0005
#define WM_ACTIVATE   0x0006

/* WM_ACTIVATE state values */

#define WA_INACTIVE     0
#define WA_ACTIVE       1
#define WA_CLICKACTIVE  2

#define WM_SETFOCUS          0x0007
#define WM_KILLFOCUS         0x0008
#define WM_ENABLE            0x000A
#define WM_SETREDRAW         0x000B
#define WM_SETTEXT           0x000C
#define WM_GETTEXT           0x000D
#define WM_GETTEXTLENGTH     0x000E
#define WM_PAINT             0x000F
#define WM_CLOSE             0x0010
#define WM_QUERYENDSESSION   0x0011
#define WM_QUIT              0x0012
#define WM_QUERYOPEN         0x0013
#define WM_ERASEBKGND        0x0014
#define WM_SYSCOLORCHANGE    0x0015
#define WM_ENDSESSION        0x0016
#define WM_SHOWWINDOW        0x0018
#define WM_WININICHANGE      0x001A
#define WM_SETTINGCHANGE     WM_WININICHANGE

#define WM_DEVMODECHANGE     0x001B
#define WM_ACTIVATEAPP       0x001C
#define WM_FONTCHANGE        0x001D
#define WM_TIMECHANGE        0x001E
#define WM_CANCELMODE        0x001F
#define WM_SETCURSOR         0x0020
#define WM_MOUSEACTIVATE     0x0021
#define WM_CHILDACTIVATE     0x0022
#define WM_QUEUESYNC         0x0023

#define WM_GETMINMAXINFO     0x0024
#define WM_PAINTICON         0x0026
#define WM_ICONERASEBKGND    0x0027
#define WM_NEXTDLGCTL        0x0028
#define WM_SPOOLERSTATUS     0x002A
#define WM_DRAWITEM          0x002B
#define WM_MEASUREITEM       0x002C
#define WM_DELETEITEM        0x002D
#define WM_VKEYTOITEM        0x002E
#define WM_CHARTOITEM        0x002F
#define WM_SETFONT           0x0030
#define WM_GETFONT           0x0031
#define WM_SETHOTKEY         0x0032
#define WM_GETHOTKEY         0x0033
#define WM_QUERYDRAGICON     0x0037
#define WM_COMPAREITEM       0x0039
#define WM_GETOBJECT         0x003D
#define WM_COMPACTING        0x0041
#define WM_COMMNOTIFY        0x0044
#define WM_WINDOWPOSCHANGING 0x0046
#define WM_WINDOWPOSCHANGED  0x0047
#define WM_POWER             0x0048

/* wParam for WM_POWER window message and DRV_POWER driver notification */

#define PWR_OK              1
#define PWR_FAIL            (-1)
#define PWR_SUSPENDREQUEST  1
#define PWR_SUSPENDRESUME   2
#define PWR_CRITICALRESUME  3

#define WM_COPYDATA         0x004A
#define WM_CANCELJOURNAL    0x004B

#define WM_NOTIFY           0x004E
#define WM_INPUTLANGCHANGEREQUEST 0x0050
#define WM_INPUTLANGCHANGE  0x0051
#define WM_TCARD            0x0052
#define WM_HELP             0x0053
#define WM_USERCHANGED      0x0054
#define WM_NOTIFYFORMAT     0x0055

#define NFR_ANSI     1
#define NFR_UNICODE  2
#define NF_QUERY     3
#define NF_REQUERY   4

#define WM_CONTEXTMENU      0x007B
#define WM_STYLECHANGING    0x007C
#define WM_STYLECHANGED     0x007D
#define WM_DISPLAYCHANGE    0x007E
#define WM_GETICON          0x007F
#define WM_SETICON          0x0080

#define WM_NCCREATE         0x0081
#define WM_NCDESTROY        0x0082
#define WM_NCCALCSIZE       0x0083
#define WM_NCHITTEST        0x0084
#define WM_NCPAINT          0x0085
#define WM_NCACTIVATE       0x0086
#define WM_GETDLGCODE       0x0087
#define WM_SYNCPAINT        0x0088
#define WM_NCMOUSEMOVE      0x00A0
#define WM_NCLBUTTONDOWN    0x00A1
#define WM_NCLBUTTONUP      0x00A2
#define WM_NCLBUTTONDBLCLK  0x00A3
#define WM_NCRBUTTONDOWN    0x00A4
#define WM_NCRBUTTONUP      0x00A5
#define WM_NCRBUTTONDBLCLK  0x00A6
#define WM_NCMBUTTONDOWN    0x00A7
#define WM_NCMBUTTONUP      0x00A8
#define WM_NCMBUTTONDBLCLK  0x00A9

#define WM_KEYFIRST         0x0100
#define WM_KEYDOWN          0x0100
#define WM_KEYUP            0x0101
#define WM_CHAR             0x0102
#define WM_DEADCHAR         0x0103
#define WM_SYSKEYDOWN       0x0104
#define WM_SYSKEYUP         0x0105
#define WM_SYSCHAR          0x0106
#define WM_SYSDEADCHAR      0x0107
#define WM_KEYLAST          0x0108

#define WM_IME_STARTCOMPOSITION         0x010D
#define WM_IME_ENDCOMPOSITION           0x010E
#define WM_IME_COMPOSITION              0x010F
#define WM_IME_KEYLAST                  0x010F

#define WM_INITDIALOG       0x0110
#define WM_COMMAND          0x0111
#define WM_SYSCOMMAND       0x0112
#define WM_TIMER            0x0113
#define WM_HSCROLL          0x0114
#define WM_VSCROLL          0x0115
#define WM_INITMENU         0x0116
#define WM_INITMENUPOPUP    0x0117
#define WM_MENUSELECT       0x011F
#define WM_MENUCHAR         0x0120
#define WM_ENTERIDLE        0x0121
#define WM_MENURBUTTONUP    0x0122
#define WM_MENUDRAG         0x0123
#define WM_MENUGETOBJECT    0x0124
#define WM_UNINITMENUPOPUP  0x0125
#define WM_MENUCOMMAND      0x0126

#define WM_CTLCOLORMSGBOX   0x0132
#define WM_CTLCOLOREDIT     0x0133
#define WM_CTLCOLORLISTBOX  0x0134
#define WM_CTLCOLORBTN      0x0135
#define WM_CTLCOLORDLG      0x0136
#define WM_CTLCOLORSCROLLBAR 0x0137
#define WM_CTLCOLORSTATIC   0x0138

#define WM_MOUSEFIRST       0x0200
#define WM_MOUSEMOVE        0x0200
#define WM_LBUTTONDOWN      0x0201
#define WM_LBUTTONUP        0x0202
#define WM_LBUTTONDBLCLK    0x0203
#define WM_RBUTTONDOWN      0x0204
#define WM_RBUTTONUP        0x0205
#define WM_RBUTTONDBLCLK    0x0206
#define WM_MBUTTONDOWN      0x0207
#define WM_MBUTTONUP        0x0208
#define WM_MBUTTONDBLCLK    0x0209

#define WHEEL_DELTA         120
#define WHEEL_PAGESCROLL    (UINT_MAX)

#define WM_PARENTNOTIFY     0x0210
#define WM_ENTERMENULOOP    0x0211
#define WM_EXITMENULOOP     0x0212

#define WM_NEXTMENU         0x0213
#define WM_SIZING           0x0214
#define WM_CAPTURECHANGED   0x0215
#define WM_MOVING           0x0216
#define WM_POWERBROADCAST   0x0218
#define WM_DEVICECHANGE     0x0219
#define WM_MDICREATE        0x0220
#define WM_MDIDESTROY       0x0221
#define WM_MDIACTIVATE      0x0222
#define WM_MDIRESTORE       0x0223
#define WM_MDINEXT          0x0224
#define WM_MDIMAXIMIZE      0x0225
#define WM_MDITILE          0x0226
#define WM_MDICASCADE       0x0227
#define WM_MDIICONARRANGE   0x0228
#define WM_MDIGETACTIVE     0x0229

#define WM_MDISETMENU       0x0230
#define WM_ENTERSIZEMOVE    0x0231
#define WM_EXITSIZEMOVE     0x0232
#define WM_DROPFILES        0x0233
#define WM_MDIREFRESHMENU   0x0234

#define WM_IME_SETCONTEXT   0x0281
#define WM_IME_NOTIFY       0x0282
#define WM_IME_CONTROL      0x0283
#define WM_IME_COMPOSITIONFULL 0x0284
#define WM_IME_SELECT       0x0285
#define WM_IME_CHAR         0x0286
#define WM_IME_REQUEST      0x0288
#define WM_IME_KEYDOWN      0x0290
#define WM_IME_KEYUP        0x0291

#define WM_MOUSEHOVER       0x02A1
#define WM_MOUSELEAVE       0x02A3

#define WM_CUT              0x0300
#define WM_COPY             0x0301
#define WM_PASTE            0x0302
#define WM_CLEAR            0x0303
#define WM_UNDO             0x0304
#define WM_RENDERFORMAT     0x0305
#define WM_RENDERALLFORMATS 0x0306
#define WM_DESTROYCLIPBOARD 0x0307
#define WM_DRAWCLIPBOARD    0x0308
#define WM_PAINTCLIPBOARD   0x0309
#define WM_VSCROLLCLIPBOARD 0x030A
#define WM_SIZECLIPBOARD    0x030B
#define WM_ASKCBFORMATNAME  0x030C
#define WM_CHANGECBCHAIN    0x030D
#define WM_HSCROLLCLIPBOARD 0x030E
#define WM_QUERYNEWPALETTE  0x030F
#define WM_PALETTEISCHANGING 0x0310
#define WM_PALETTECHANGED   0x0311
#define WM_HOTKEY           0x0312

#define WM_PRINT            0x0317
#define WM_PRINTCLIENT      0x0318

#define WM_HANDHELDFIRST    0x0358
#define WM_HANDHELDLAST     0x035F

#define WM_AFXFIRST         0x0360
#define WM_AFXLAST          0x037F

#define WM_PENWINFIRST      0x0380
#define WM_PENWINLAST       0x038F
#define WM_APP              0x8000

#define WM_USER             0x0400

/*  wParam for WM_SIZING message  */

#define WMSZ_LEFT           1
#define WMSZ_RIGHT          2
#define WMSZ_TOP            3
#define WMSZ_TOPLEFT        4
#define WMSZ_TOPRIGHT       5
#define WMSZ_BOTTOM         6
#define WMSZ_BOTTOMLEFT     7
#define WMSZ_BOTTOMRIGHT    8

/* WM_NCHITTEST and MOUSEHOOKSTRUCT Mouse Position Codes */

#define HTERROR        (-2)
#define HTTRANSPARENT  (-1)
#define HTNOWHERE      0
#define HTCLIENT       1
#define HTCAPTION      2
#define HTSYSMENU      3
#define HTGROWBOX      4
#define HTSIZE         HTGROWBOX
#define HTMENU         5
#define HTHSCROLL      6
#define HTVSCROLL      7
#define HTMINBUTTON    8
#define HTMAXBUTTON    9
#define HTLEFT        10
#define HTRIGHT       11
#define HTTOP         12
#define HTTOPLEFT     13
#define HTTOPRIGHT    14
#define HTBOTTOM      15
#define HTBOTTOMLEFT  16
#define HTBOTTOMRIGHT 17
#define HTBORDER      18
#define HTREDUCE       HTMINBUTTON
#define HTZOOM         HTMAXBUTTON
#define HTSIZEFIRST    HTLEFT
#define HTSIZELAST     HTBOTTOMRIGHT
#define HTOBJECT      19
#define HTCLOSE       20
#define HTHELP        21

#define SMTO_NORMAL             0x0000
#define SMTO_BLOCK              0x0001
#define SMTO_ABORTIFHUNG        0x0002
#define SMTO_NOTIMEOUTIFNOTHUNG 0x0008

/* WM_MOUSEACTIVATE Return Codes */

#define MA_ACTIVATE         1
#define MA_ACTIVATEANDEAT   2
#define MA_NOACTIVATE       3
#define MA_NOACTIVATEANDEAT 4

/* WM_SETICON / WM_GETICON Type Codes */

#define ICON_SMALL      0
#define ICON_BIG        1

/* WM_SIZE message wParam values */

#define SIZE_RESTORED   0
#define SIZE_MINIMIZED  1
#define SIZE_MAXIMIZED  2
#define SIZE_MAXSHOW    3
#define SIZE_MAXHIDE    4

/* Obsolete constant names */

#define SIZENORMAL      SIZE_RESTORED
#define SIZEICONIC      SIZE_MINIMIZED
#define SIZEFULLSCREEN  SIZE_MAXIMIZED
#define SIZEZOOMSHOW    SIZE_MAXSHOW
#define SIZEZOOMHIDE    SIZE_MAXHIDE

/* WM_NCCALCSIZE "window valid rect" return values */

#define WVR_ALIGNTOP    0x0010
#define WVR_ALIGNLEFT   0x0020
#define WVR_ALIGNBOTTOM 0x0040
#define WVR_ALIGNRIGHT  0x0080
#define WVR_HREDRAW     0x0100
#define WVR_VREDRAW     0x0200
#define WVR_REDRAW      (WVR_HREDRAW | WVR_VREDRAW)

/* Key State Masks for Mouse Messages */

#define MK_LBUTTON      0x0001
#define MK_RBUTTON      0x0002
#define MK_SHIFT        0x0004
#define MK_CONTROL      0x0008
#define MK_MBUTTON      0x0010

#define TME_HOVER       0x00000001
#define TME_LEAVE       0x00000002
#define TME_QUERY       0x40000000
#define TME_CANCEL      0x80000000

#define HOVER_DEFAULT   0xFFFFFFFF

/* Window Styles */

#define WS_OVERLAPPED   0x00000000L
#define WS_POPUP        0x80000000L
#define WS_CHILD        0x40000000L
#define WS_MINIMIZE     0x20000000L
#define WS_VISIBLE      0x10000000L
#define WS_DISABLED     0x08000000L
#define WS_CLIPSIBLINGS 0x04000000L
#define WS_CLIPCHILDREN 0x02000000L
#define WS_MAXIMIZE     0x01000000L
#define WS_CAPTION      0x00C00000L
#define WS_BORDER       0x00800000L
#define WS_DLGFRAME     0x00400000L
#define WS_VSCROLL      0x00200000L
#define WS_HSCROLL      0x00100000L
#define WS_SYSMENU      0x00080000L
#define WS_THICKFRAME   0x00040000L
#define WS_GROUP        0x00020000L   // début et fin d'un groupe
#define WS_TABSTOP      0x00010000L   // focus de Tab ou Maj+Tab

#define WS_MINIMIZEBOX  0x00020000L
#define WS_MAXIMIZEBOX  0x00010000L

#define WS_TILED        WS_OVERLAPPED
#define WS_ICONIC       WS_MINIMIZE
#define WS_SIZEBOX      WS_THICKFRAME
#define WS_TILEDWINDOW  WS_OVERLAPPEDWINDOW

/* Common Window Styles */

#define WS_OVERLAPPEDWINDOW (WS_OVERLAPPED     | \
                             WS_CAPTION        | \
                             WS_SYSMENU        | \
                             WS_THICKFRAME     | \
                             WS_MINIMIZEBOX    | \
                             WS_MAXIMIZEBOX)

#define WS_POPUPWINDOW      (WS_POPUP          | \
                             WS_BORDER         | \
                             WS_SYSMENU)

#define WS_CHILDWINDOW      (WS_CHILD)

/* Extended Window Styles */

#define WS_EX_DLGMODALFRAME    0x00000001L
#define WS_EX_NOPARENTNOTIFY   0x00000004L
#define WS_EX_TOPMOST          0x00000008L
#define WS_EX_ACCEPTFILES      0x00000010L
#define WS_EX_TRANSPARENT      0x00000020L
#define WS_EX_MDICHILD         0x00000040L
#define WS_EX_TOOLWINDOW       0x00000080L
#define WS_EX_WINDOWEDGE       0x00000100L
#define WS_EX_CLIENTEDGE       0x00000200L
#define WS_EX_CONTEXTHELP      0x00000400L
#define WS_EX_RIGHT            0x00001000L
#define WS_EX_LEFT             0x00000000L
#define WS_EX_RTLREADING       0x00002000L
#define WS_EX_LTRREADING       0x00000000L
#define WS_EX_LEFTSCROLLBAR    0x00004000L
#define WS_EX_RIGHTSCROLLBAR   0x00000000L
#define WS_EX_CONTROLPARENT    0x00010000L
#define WS_EX_STATICEDGE       0x00020000L
#define WS_EX_APPWINDOW        0x00040000L
#define WS_EX_OVERLAPPEDWINDOW (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE)
#define WS_EX_PALETTEWINDOW    (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST)

/* Class styles */

#define CS_VREDRAW         0x0001
#define CS_HREDRAW         0x0002
#define CS_DBLCLKS         0x0008
#define CS_OWNDC           0x0020
#define CS_CLASSDC         0x0040
#define CS_PARENTDC        0x0080
#define CS_NOCLOSE         0x0200
#define CS_SAVEBITS        0x0800
#define CS_BYTEALIGNCLIENT 0x1000
#define CS_BYTEALIGNWINDOW 0x2000
#define CS_GLOBALCLASS     0x4000

#define CS_IME             0x00010000

/* Predefined Clipboard Formats */

#define CF_TEXT            1
#define CF_BITMAP          2
#define CF_METAFILEPICT    3
#define CF_SYLK            4
#define CF_DIF             5
#define CF_TIFF            6
#define CF_OEMTEXT         7
#define CF_DIB             8
#define CF_PALETTE         9
#define CF_PENDATA         10
#define CF_RIFF            11
#define CF_WAVE            12
#define CF_UNICODETEXT     13
#define CF_ENHMETAFILE     14
#define CF_HDROP           15
#define CF_LOCALE          16
#define CF_MAX             17
#define CF_OWNERDISPLAY    0x0080
#define CF_DSPTEXT         0x0081
#define CF_DSPBITMAP       0x0082
#define CF_DSPMETAFILEPICT 0x0083
#define CF_DSPENHMETAFILE  0x008E

/* "Private" formats don't get GlobalFree()'d */

#define CF_PRIVATEFIRST    0x0200
#define CF_PRIVATELAST     0x02FF

/* "GDIOBJ" formats do get DeleteObject()'d */

#define CF_GDIOBJFIRST     0x0300
#define CF_GDIOBJLAST      0x03FF

/* Menu flags for Add/Check/EnableMenuItem() */

#define MF_INSERT          0x00000000L
#define MF_CHANGE          0x00000080L
#define MF_APPEND          0x00000100L
#define MF_DELETE          0x00000200L
#define MF_REMOVE          0x00001000L

#define MF_BYCOMMAND       0x00000000L
#define MF_BYPOSITION      0x00000400L

#define MF_SEPARATOR       0x00000800L

#define MF_ENABLED         0x00000000L
#define MF_GRAYED          0x00000001L
#define MF_DISABLED        0x00000002L

#define MF_UNCHECKED       0x00000000L
#define MF_CHECKED         0x00000008L
#define MF_USECHECKBITMAPS 0x00000200L

#define MF_STRING          0x00000000L
#define MF_BITMAP          0x00000004L
#define MF_OWNERDRAW       0x00000100L

#define MF_POPUP           0x00000010L
#define MF_MENUBARBREAK    0x00000020L
#define MF_MENUBREAK       0x00000040L

#define MF_UNHILITE        0x00000000L
#define MF_HILITE          0x00000080L

#define MF_DEFAULT         0x00001000L
#define MF_SYSMENU         0x00002000L
#define MF_HELP            0x00004000L
#define MF_RIGHTJUSTIFY    0x00004000L

#define MF_MOUSESELECT     0x00008000L
#define MF_END             0x00000080L

#define MFT_STRING         MF_STRING
#define MFT_BITMAP         MF_BITMAP
#define MFT_MENUBARBREAK   MF_MENUBARBREAK
#define MFT_MENUBREAK      MF_MENUBREAK
#define MFT_OWNERDRAW      MF_OWNERDRAW
#define MFT_RADIOCHECK     0x00000200L
#define MFT_SEPARATOR      MF_SEPARATOR
#define MFT_RIGHTORDER     0x00002000L
#define MFT_RIGHTJUSTIFY   MF_RIGHTJUSTIFY

/* Menu flags for Add/Check/EnableMenuItem() */

#define MFS_GRAYED        0x00000003L
#define MFS_DISABLED      MFS_GRAYED
#define MFS_CHECKED       MF_CHECKED
#define MFS_HILITE        MF_HILITE
#define MFS_ENABLED       MF_ENABLED
#define MFS_UNCHECKED     MF_UNCHECKED
#define MFS_UNHILITE      MF_UNHILITE
#define MFS_DEFAULT       MF_DEFAULT
#define MFS_MASK          0x0000108BL
#define MFS_HOTTRACKDRAWN 0x10000000L
#define MFS_CACHEDBMP     0x20000000L
#define MFS_BOTTOMGAPDROP 0x40000000L
#define MFS_TOPGAPDROP    0x80000000L
#define MFS_GAPDROP       0xC0000000L

#define MF_END            0x00000080L

/* System Menu Command Values */

#define SC_SIZE         0xF000
#define SC_MOVE         0xF010
#define SC_MINIMIZE     0xF020
#define SC_MAXIMIZE     0xF030
#define SC_NEXTWINDOW   0xF040
#define SC_PREVWINDOW   0xF050
#define SC_CLOSE        0xF060
#define SC_VSCROLL      0xF070
#define SC_HSCROLL      0xF080
#define SC_MOUSEMENU    0xF090
#define SC_KEYMENU      0xF100
#define SC_ARRANGE      0xF110
#define SC_RESTORE      0xF120
#define SC_TASKLIST     0xF130
#define SC_SCREENSAVE   0xF140
#define SC_HOTKEY       0xF150
#define SC_DEFAULT      0xF160
#define SC_MONITORPOWER 0xF170
#define SC_CONTEXTHELP  0xF180
#define SC_SEPARATOR    0xF00F

/* Obsolete names */

#define SC_ICON         SC_MINIMIZE
#define SC_ZOOM         SC_MAXIMIZE

/* OEM Resource Ordinal Numbers */

#define OBM_CLOSE       32754
#define OBM_UPARROW     32753
#define OBM_DNARROW     32752
#define OBM_RGARROW     32751
#define OBM_LFARROW     32750
#define OBM_REDUCE      32749
#define OBM_ZOOM        32748
#define OBM_RESTORE     32747
#define OBM_REDUCED     32746
#define OBM_ZOOMD       32745
#define OBM_RESTORED    32744
#define OBM_UPARROWD    32743
#define OBM_DNARROWD    32742
#define OBM_RGARROWD    32741
#define OBM_LFARROWD    32740
#define OBM_MNARROW     32739
#define OBM_COMBO       32738
#define OBM_UPARROWI    32737
#define OBM_DNARROWI    32736
#define OBM_RGARROWI    32735
#define OBM_LFARROWI    32734

#define OBM_OLD_CLOSE   32767
#define OBM_SIZE        32766
#define OBM_OLD_UPARROW 32765
#define OBM_OLD_DNARROW 32764
#define OBM_OLD_RGARROW 32763
#define OBM_OLD_LFARROW 32762
#define OBM_BTSIZE      32761
#define OBM_CHECK       32760
#define OBM_CHECKBOXES  32759
#define OBM_BTNCORNERS  32758
#define OBM_OLD_REDUCE  32757
#define OBM_OLD_ZOOM    32756
#define OBM_OLD_RESTORE 32755

#define OCR_NORMAL      32512
#define OCR_IBEAM       32513
#define OCR_WAIT        32514
#define OCR_CROSS       32515
#define OCR_UP          32516
#define OCR_SIZE        32640
#define OCR_ICON        32641
#define OCR_SIZENWSE    32642
#define OCR_SIZENESW    32643
#define OCR_SIZEWE      32644
#define OCR_SIZENS      32645
#define OCR_SIZEALL     32646
#define OCR_ICOCUR      32647
#define OCR_NO          32648
#define OCR_HAND        32649
#define OCR_APPSTARTING 32650

#define OIC_SAMPLE      32512
#define OIC_HAND        32513
#define OIC_QUES        32514
#define OIC_BANG        32515
#define OIC_NOTE        32516
#define OIC_WINLOGO     32517
#define OIC_WARNING     OIC_BANG
#define OIC_ERROR       OIC_HAND
#define OIC_INFORMATION OIC_NOTE

/* Standard Icon IDs */

#define IDI_APPLICATION 32512
#define IDI_HAND        32513
#define IDI_QUESTION    32514
#define IDI_EXCLAMATION 32515
#define IDI_ASTERISK    32516
#define IDI_WINLOGO     32517
#define IDI_WARNING     IDI_EXCLAMATION
#define IDI_ERROR       IDI_HAND
#define IDI_INFORMATION IDI_ASTERISK

/* Dialog Box Command IDs */

#define IDOK        1
#define IDCANCEL    2
#define IDABORT     3
#define IDRETRY     4
#define IDIGNORE    5
#define IDYES       6
#define IDNO        7
#define IDCLOSE     8
#define IDHELP      9

;==C==================================================== Edit Control Styles

/* Edit Control Styles */

#define ES_LEFT        0x0000L  // le texte est aligné à gauche
#define ES_CENTER      0x0001L  // le texte est centré
#define ES_RIGHT       0x0002L  // le texte est aligné à droite
#define ES_MULTILINE   0x0004L  // il peut y avoir ou converti en plusieurs lignes d'édition
#define ES_UPPERCASE   0x0008L  // converti en majuscules sont affichées
#define ES_LOWERCASE   0x0010L  // converti en minuscules sont affichées
#define ES_PASSWORD    0x0020L  // tous les caractères sont des étoiles "*". No copy
#define ES_AUTOVSCROLL 0x0040L  // scroll vertical
#define ES_AUTOHSCROLL 0x0080L  // scroll horizontale
#define ES_NOHIDESEL   0x0100L  // La selection non cachée lorsque la zone d'édition perdra le focus
#define ES_OEMCONVERT  0x0400L  // converti en caractéres ANSI
#define ES_READONLY    0x0800L
#define ES_WANTRETURN  0x1000L
#define ES_NUMBER      0x2000L  // n'accepte que les chiffres

/* Edit Control Messages */

#define EM_GETSEL       0x00B0
#define EM_SETSEL       0x00B1
#define EM_GETRECT      0x00B2
#define EM_SETRECT      0x00B3
#define EM_SETRECTNP    0x00B4
#define EM_SCROLL       0x00B5
#define EM_LINESCROLL   0x00B6
#define EM_SCROLLCARET  0x00B7
#define EM_GETMODIFY    0x00B8
#define EM_SETMODIFY    0x00B9
#define EM_GETLINECOUNT 0x00BA
#define EM_LINEINDEX    0x00BB
#define EM_SETHANDLE    0x00BC
#define EM_GETHANDLE    0x00BD
#define EM_GETTHUMB     0x00BE
#define EM_LINELENGTH   0x00C1
#define EM_REPLACESEL   0x00C2
#define EM_GETLINE      0x00C4
#define EM_LIMITTEXT    0x00C5
#define EM_CANUNDO      0x00C6
#define EM_UNDO         0x00C7
#define EM_FMTLINES     0x00C8
#define EM_LINEFROMCHAR 0x00C9
#define EM_SETTABSTOPS  0x00CB
#define EM_SETPASSWORDCHAR     0x00CC
#define EM_EMPTYUNDOBUFFER     0x00CD
#define EM_GETFIRSTVISIBLELINE 0x00CE
#define EM_SETREADONLY         0x00CF
#define EM_SETWORDBREAKPROC    0x00D0
#define EM_GETWORDBREAKPROC    0x00D1
#define EM_GETPASSWORDCHAR     0x00D2
#define EM_SETMARGINS          0x00D3
#define EM_GETMARGINS          0x00D4
#define EM_SETLIMITTEXT        EM_LIMITTEXT
#define EM_GETLIMITTEXT        0x00D5
#define EM_POSFROMCHAR         0x00D6
#define EM_CHARFROMPOS         0x00D7
#define EM_SETIMESTATUS 0x00D8
#define EM_GETIMESTATUS 0x00D9

/* Button Control Styles */

#define BS_PUSHBUTTON       0x00000000L // Button poussoir
#define BS_DEFPUSHBUTTON    0x00000001L // Button par default
#define BS_CHECKBOX         0x00000002L // Case à cocher
#define BS_AUTOCHECKBOX     0x00000003L // Case à cocher avec changemnt d'état automatique
#define BS_RADIOBUTTON      0x00000004L // Button radio
#define BS_3STATE           0x00000005L // 3 états, gris_inactif coché  non_coché
#define BS_AUTO3STATE       0x00000006L // idem above avec changemnt d'état automatique
#define BS_GROUPBOX         0x00000007L // Zone Rect. groupant les buttons à intérieur
#define BS_USERBUTTON       0x00000008L
#define BS_AUTORADIOBUTTON  0x00000009L // idem button radio + changmnt d'état automatique
#define BS_OWNERDRAW        0x0000000BL // button dessiné par l'user's prgm
#define BS_LEFTTEXT         0x00000020L // Texte à gauche des buttons radio et checkbox
#define BS_TEXT             0x00000000L // Button display du text
#define BS_ICON             0x00000040L // Button affiche une icone
#define BS_BITMAP           0x00000080L // Button affiche image en mode point
#define BS_LEFT             0x00000100L // Aligne le text à gauche
#define BS_RIGHT            0x00000200L // Aligne le text à droite
#define BS_CENTER           0x00000300L // Centre le text
#define BS_TOP              0x00000400L // Coté supérieur
#define BS_BOTTOM           0x00000800L // Bas du rect.button
#define BS_VCENTER          0x00000C00L // Centre Vertical du rect.button
#define BS_PUSHLIKE         0x00001000L //
#define BS_MULTILINE        0x00002000L // si ligne text trop longue  CRLF..
#define BS_NOTIFY           0x00004000L //
#define BS_FLAT             0x00008000L //
#define BS_RIGHTBUTTON      BS_LEFTTEXT //

/* User Button Notification Codes      Retour de CLICK via WM_COMMAND */

#define BN_CLICKED       0
#define BN_PAINT         1
#define BN_HILITE        2
#define BN_UNHILITE      3
#define BN_DISABLE       4
#define BN_DOUBLECLICKED 5
#define BN_PUSHED        BN_HILITE
#define BN_UNPUSHED      BN_UNHILITE
#define BN_DBLCLK        BN_DOUBLECLICKED
#define BN_SETFOCUS      6
#define BN_KILLFOCUS     7

/* Button Control Messages */

#define BM_GETCHECK      0x00F0
#define BM_SETCHECK      0x00F1
#define BM_GETSTATE      0x00F2
#define BM_SETSTATE      0x00F3
#define BM_SETSTYLE      0x00F4
#define BM_CLICK         0x00F5
#define BM_GETIMAGE      0x00F6
#define BM_SETIMAGE      0x00F7

#define BST_UNCHECKED     0x0000
#define BST_CHECKED       0x0001
#define BST_INDETERMINATE 0x0002
#define BST_PUSHED        0x0004
#define BST_FOCUS         0x0008

/* Static Control Constants .. Style   */

#define SS_LEFT           0x00000000L
#define SS_CENTER         0x00000001L
#define SS_RIGHT          0x00000002L
#define SS_ICON           0x00000003L
#define SS_BLACKRECT      0x00000004L
#define SS_GRAYRECT       0x00000005L
#define SS_WHITERECT      0x00000006L
#define SS_BLACKFRAME     0x00000007L   // cadre noir sur le texte
#define SS_GRAYFRAME      0x00000008L
#define SS_WHITEFRAME     0x00000009L
#define SS_USERITEM       0x0000000AL
#define SS_SIMPLE         0x0000000BL
#define SS_LEFTNOWORDWRAP 0x0000000CL
#define SS_OWNERDRAW      0x0000000DL
#define SS_BITMAP         0x0000000EL
#define SS_ENHMETAFILE    0x0000000FL
#define SS_ETCHEDHORZ     0x00000010L
#define SS_ETCHEDVERT     0x00000011L
#define SS_ETCHEDFRAME    0x00000012L
#define SS_TYPEMASK       0x0000001FL
#define SS_NOPREFIX       0x00000080L
#define SS_NOTIFY         0x00000100L
#define SS_CENTERIMAGE    0x00000200L
#define SS_RIGHTJUST      0x00000400L
#define SS_REALSIZEIMAGE  0x00000800L
#define SS_SUNKEN         0x00001000L
#define SS_ENDELLIPSIS    0x00004000L
#define SS_PATHELLIPSIS   0x00008000L
#define SS_WORDELLIPSIS   0x0000C000L
#define SS_ELLIPSISMASK   0x0000C000L

/* Dialog Styles */

#define DS_ABSALIGN       0x01L
#define DS_SYSMODAL       0x02L
#define DS_LOCALEDIT      0x20L
#define DS_SETFONT        0x40L
#define DS_MODALFRAME     0x80L
#define DS_NOIDLEMSG      0x100L
#define DS_SETFOREGROUND  0x200L

#define DS_3DLOOK         0x0004L
#define DS_FIXEDSYS       0x0008L
#define DS_NOFAILCREATE   0x0010L
#define DS_CONTROL        0x0400L
#define DS_CENTER         0x0800L
#define DS_CENTERMOUSE    0x1000L
#define DS_CONTEXTHELP    0x2000L

/* Listbox Styles */

#define LBS_NOTIFY            0x0001L
#define LBS_SORT              0x0002L
#define LBS_NOREDRAW          0x0004L
#define LBS_MULTIPLESEL       0x0008L
#define LBS_OWNERDRAWFIXED    0x0010L
#define LBS_OWNERDRAWVARIABLE 0x0020L
#define LBS_HASSTRINGS        0x0040L
#define LBS_USETABSTOPS       0x0080L
#define LBS_NOINTEGRALHEIGHT  0x0100L
#define LBS_MULTICOLUMN       0x0200L
#define LBS_WANTKEYBOARDINPUT 0x0400L
#define LBS_EXTENDEDSEL       0x0800L
#define LBS_DISABLENOSCROLL   0x1000L
#define LBS_NODATA            0x2000L
#define LBS_NOSEL             0x4000L
#define LBS_STANDARD          (LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER)

/* Combo Box styles */

#define CBS_SIMPLE            0x0001L
#define CBS_DROPDOWN          0x0002L
#define CBS_DROPDOWNLIST      0x0003L
#define CBS_OWNERDRAWFIXED    0x0010L
#define CBS_OWNERDRAWVARIABLE 0x0020L
#define CBS_AUTOHSCROLL       0x0040L
#define CBS_OEMCONVERT        0x0080L
#define CBS_SORT              0x0100L
#define CBS_HASSTRINGS        0x0200L
#define CBS_NOINTEGRALHEIGHT  0x0400L
#define CBS_DISABLENOSCROLL   0x0800L
#define CBS_UPPERCASE         0x2000L
#define CBS_LOWERCASE          0x4000L

/* Scroll Bar Styles */

#define SBS_HORZ                    0x0000L
#define SBS_VERT                    0x0001L
#define SBS_TOPALIGN                0x0002L
#define SBS_LEFTALIGN               0x0002L
#define SBS_BOTTOMALIGN             0x0004L
#define SBS_RIGHTALIGN              0x0004L
#define SBS_SIZEBOXTOPLEFTALIGN     0x0002L
#define SBS_SIZEBOXBOTTOMRIGHTALIGN 0x0004L
#define SBS_SIZEBOX                 0x0008L
#define SBS_SIZEGRIP                0x0010L

/* Commands to pass to WinHelp() */

#define HELP_CONTEXT      0x0001L
#define HELP_QUIT         0x0002L
#define HELP_INDEX        0x0003L
#define HELP_CONTENTS     0x0003L
#define HELP_HELPONHELP   0x0004L
#define HELP_SETINDEX     0x0005L
#define HELP_SETCONTENTS  0x0005L
#define HELP_CONTEXTPOPUP 0x0008L
#define HELP_FORCEFILE    0x0009L
#define HELP_KEY          0x0101L
#define HELP_COMMAND      0x0102L
#define HELP_PARTIALKEY   0x0105L
#define HELP_MULTIKEY     0x0201L
#define HELP_SETWINPOS    0x0203L
#define HELP_CONTEXTMENU  0x000a
#define HELP_FINDER       0x000b
#define HELP_WM_HELP      0x000c
#define HELP_SETPOPUP_POS 0x000d

#define HELP_TCARD              0x8000
#define HELP_TCARD_DATA         0x0010
#define HELP_TCARD_OTHER_CALLER 0x0011

/* These are in winhelp.h in Win95. */

#define IDH_NO_HELP             28440
#define IDH_MISSING_CONTEXT     28441
#define IDH_GENERIC_HELP_BUTTON 28442
#define IDH_OK                  28443
#define IDH_CANCEL              28444
#define IDH_HELP                28445

#define IDC_STATIC     -1
#define IDC_EDIT1    3000
#define IDC_EDIT2    3001
#define IDC_BUTTON1  3002
#define IDC_BUTTON2  3003
#define IDC_USER1    3000


Exemple

// Resource script for Exemple
#include "resource.h"
#include <windows.h>
/* Version information */
#ifndef DEBUG
#define VER_DEBUG 0
#else
#define VER_DEBUG VS_FF_DEBUG
#endif
#ifdef RC_INVOKED
#endif
#define VER_FILEVERSION 4,0,0,2
#define ID_EDIT1 101
#define ID_EDIT2 102

#define ID_BUTTON1 201
#define ID_BUTTON2 202
#define ID_BUTTON3 203

#define ID_STATIC -1
500 ICON MOVEABLE PURE LOADONCALL DISCARDABLE "nested.ico"
31011 CURSOR "Cursor_15.cur"
31234 ICON "Icon_1.ico"
GENERIC ICON DISCARDABLE "GENERIC.ICO"
SMALL ICON DISCARDABLE "SMALL.ICO"
/* Bitmaps placed on top of TB buttons */
BMP1 BITMAP "bmp1.bmp"
BMP2 BITMAP "bmp2.bmp"


Exemple

104 DIALOG 0, 0, 283, 217
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION | WS_SYSMENU
CAPTION ""
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
FONT 8, "MS Sans Serif"
{
CONTROL "", 1051, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 5, 5, 132, 40
CONTROL "Slider1", 1001, "msctls_trackbar32", TBS_HORZ | TBS_BOTH | TBS_NOTICKS | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 15, 121, 15
CONTROL "0", 1002, STATIC, SS_CENTER | WS_CHILD | WS_VISIBLE, 52, 33, 38, 8
CONTROL "", 1079, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 5, 47, 132, 50
CONTROL "Slider1", 1080, "msctls_trackbar32", TBS_HORZ | TBS_BOTH | TBS_NOTICKS | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 57, 121, 15
CONTROL "0", 1081, STATIC, SS_CENTER | WS_CHILD | WS_VISIBLE, 52, 75, 38, 8
CONTROL "", 1082, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 13, 82, 111, 10
CONTROL "", 1057, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 5, 98, 132, 104
CONTROL "", 1019, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 13, 109, 121, 10
CONTROL "", 1018, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 13, 122, 121, 10
CONTROL "", 1017, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 13, 135, 121, 10
CONTROL "", 1015, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 13, 147, 122, 10
CONTROL "", 1016, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 13, 160, 121, 10
CONTROL "", 1071, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 13, 173, 121, 10
CONTROL "", 1069, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 13, 186, 121, 8
CONTROL "", 1052, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 145, 5, 132, 40
CONTROL "Slider1", 1011, "msctls_trackbar32", TBS_HORZ | TBS_AUTOTICKS | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 149, 15, 123, 20
CONTROL "Low", 1053, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 149, 35, 39, 8
CONTROL "Normal", 1054, STATIC, SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 184, 35, 55, 8
CONTROL "High", 1055, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 230, 35, 41, 8
CONTROL "", 1068, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 145, 47, 132, 34
CONTROL "", 1067, COMBOBOX, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 152, 61, 115, 69
CONTROL "", 1060, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 145, 82, 132, 67
CONTROL "", 1009, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 153, 93, 121, 10
CONTROL "", 1010, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 153, 106, 120, 10
CONTROL "", 1022, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 153, 119, 118, 10
CONTROL "", 1072, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 153, 132, 121, 10
CONTROL "", 1056, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 145, 150, 132, 52
CONTROL "", 1006, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 153, 161, 120, 10
CONTROL "", 1007, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 153, 174, 120, 10
CONTROL "", 1008, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 153, 187, 120, 10
}

106 DIALOGEX 0, 0, 283, 218
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION | WS_SYSMENU
CAPTION ""
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
FONT 8, "MS Sans Serif"
{
CONTROL "", 1096, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 5, 5, 271, 37
CONTROL "", 1095, COMBOBOX, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 11, 17, 256, 103
CONTROL "", 1097, BUTTON, BS_GROUPBOX | WS_CHILD | WS_DISABLED, 5, 45, 271, 157
CONTROL "", 1098, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_DISABLED | WS_TABSTOP, 13, 57, 245, 10
}

107 DIALOGEX 0, 0, 290, 175
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION ""
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
FONT 8, "MS Sans Serif"
{
CONTROL "&OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 235, 156, 50, 14
CONTROL "List1", 1024, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 3, 10, 225, 161
CONTROL "", 1031, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 235, 10, 50, 14
CONTROL "", 1041, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 235, 30, 50, 14
CONTROL "", 1042, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 235, 50, 50, 14
CONTROL "", 1045, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 235, 70, 50, 14
}

108 DIALOGEX 0, 0, 275, 287
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION ""
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
FONT 8, "MS Sans Serif"
{
CONTROL "", 1061, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 5, 103, 8
CONTROL "", 1039, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 5, 15, 93, 13
CONTROL "", 1062, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 34, 95, 8
CONTROL "...", 1085, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 105, 35, 149, 8
CONTROL "", 1025, COMBOBOX, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 5, 44, 93, 65
CONTROL "", 1063, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 65, 92, 8
CONTROL "...", 1084, STATIC, SS_LEFT | WS_CHILD | WS_GROUP, 105, 65, 127, 8
CONTROL "", 1083, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_BORDER | WS_TABSTOP, 105, 76, 50, 14
CONTROL "", 1064, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 4, 98, 266, 164
CONTROL "", 1026, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 111, 113, 8
CONTROL "", 1065, STATIC, SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 102, 112, 133, 8
CONTROL "", 1028, EDIT, ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 84, 123, 174, 31
CONTROL "", 1012, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 158, 120, 8
CONTROL "", 1046, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_BORDER | WS_TABSTOP, 10, 171, 225, 13
CONTROL "...", 1049, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 241, 171, 16, 13
CONTROL "-", 1088, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_GROUP, 14, 186, 220, 8
CONTROL "", 1086, EDIT, ES_LEFT | ES_AUTOHSCROLL | ES_NUMBER | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_BORDER | WS_TABSTOP, 14, 196, 40, 14
CONTROL "", 1090, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 179, 196, 86, 8
CONTROL "", 1027, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 216, 84, 8
CONTROL "", 1030, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_BORDER | WS_TABSTOP, 10, 228, 225, 13
CONTROL "...", 1050, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 241, 229, 16, 13
CONTROL "", 1047, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 246, 225, 8
CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 165, 268, 50, 14
CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 220, 268, 50, 14
}

112 DIALOG 0, 0, 236, 133
STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION ""
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
FONT 8, "MS Sans Serif"
{
CONTROL "&Close", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 93, 114, 50, 14
CONTROL "", 1041, EDIT, ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | WS_CHILD | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 2, 30, 231, 71
}

146 DIALOG 0, 0, 283, 217
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION | WS_SYSMENU
CAPTION ""
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
FONT 8, "MS Sans Serif"
{
CONTROL "", 1059, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 5, 5, 129, 134
CONTROL "", 1073, LISTBOX, LBS_STANDARD | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 11, 17, 117, 115
CONTROL "", 1058, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 142, 4, 135, 58
CONTROL "", 1020, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 149, 15, 120, 10
CONTROL "", 1070, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 149, 28, 120, 10
CONTROL "", 1078, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 149, 41, 121, 10
CONTROL "", 1074, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 142, 65, 135, 74
CONTROL "Slider1", 1075, "msctls_trackbar32", TBS_HORZ | TBS_AUTOTICKS | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 146, 79, 120, 20
CONTROL "100 %", 1077, STATIC, SS_CENTER | WS_CHILD | WS_VISIBLE, 186, 100, 35, 10
CONTROL "", 1076, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 146, 114, 120, 10
}

147 DIALOG 0, 0, 283, 217
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION | WS_SYSMENU
CAPTION ""
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
FONT 8, "MS Sans Serif"
{
CONTROL "", 1093, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 5, 5, 197, 164
CONTROL "List1", 1091, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 11, 17, 126, 144
CONTROL "", 1092, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 143, 28, 51, 14
CONTROL "-", 1094, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 14, 176, 240, 8
}

30721 DIALOG 9, 26, 183, 70
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "New"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
CONTROL "&New ", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 6, 5, 123, 8
CONTROL "", 100, LISTBOX, LBS_NOTIFY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 6, 15, 125, 49
CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 137, 6, 40, 14
CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 137, 23, 40, 14
CONTROL "&Help", -7866, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 137, 43, 40, 14
}


Exemple

216 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "&Edit"
{
MENUITEM "Ope&n", 33042
MENUITEM "Expl&ore", 33073
MENUITEM "Comp&ilation Properties\tF7", 33009
MENUITEM "&Find...\tCtrl+F", 57636
MENUITEM SEPARATOR
POPUP "Vie&w"
{
MENUITEM "&Original", 33021
MENUITEM "ISO Level &1", 33039
MENUITEM "ISO Level &2", 33184
MENUITEM "&Joliet", 33183
MENUITEM SEPARATOR
MENUITEM "Lar&ge Icons", 33067
MENUITEM "S&mall Icons", 33068
MENUITEM "&List", 59410
MENUITEM "&Details", 59411
}
POPUP "Arran&ge Icons By"
{
MENUITEM "&Name", 33001
MENUITEM "T&ype", 33185
MENUITEM "Si&ze", 33186
MENUITEM "&Date", 33187
MENUITEM SEPARATOR
MENUITEM "D&o Not Sort", 33019
}
MENUITEM SEPARATOR
MENUITEM "Cu&t\tCtrl+X", 57635
MENUITEM "&Copy\tCtrl+C", 57634
MENUITEM "Cop&y to Compilation\tCtrl+1", 33096
MENUITEM "&Paste\tCtrl+V", 57637
MENUITEM "Paste &Shortcut", 33072
MENUITEM SEPARATOR
MENUITEM "&Delete\tDel", 57632
MENUITEM "Rena&me\tF2", 33501
MENUITEM SEPARATOR
MENUITEM "Select &All", 33040
MENUITEM "Se&lect Pattern...", 33069
MENUITEM "In&vert Selection", 33003
MENUITEM SEPARATOR
MENUITEM "Add Fil&es...\tCtrl+D", 33018
MENUITEM "C&reate Folder", 33006
MENUITEM SEPARATOR
MENUITEM "&Help", 33044
MENUITEM SEPARATOR
MENUITEM "Pr&operties\tAlt+Enter", 33500
MENUITEM "A&udio Editor", 33078
}
}


Exemple

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
61440, "Open"
61441, "Save As"
61442, "All Files (*.*)"
61443, "Untitled"
61446, "an unnamed file"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
61457, "&Hide"
}


Exemple

1 VERSIONINFO
FILEVERSION 8,0,0,0
PRODUCTVERSION 8,0,0,0
FILEOS 0x4
FILETYPE 0x1
{
BLOCK "StringFileInfo"
{
BLOCK "040904B0"
{
VALUE "CompanyName", "Adobe Systems, Incorporated"
VALUE "FileDescription", "Adobe Photoshop CS"
VALUE "FileVersion", "8.0 (8.0x118)"
VALUE "InternalName", "Photoshop"
VALUE "LegalCopyright", "Copyright 2003 Adobe Systems Inc."
VALUE "OriginalFilename", "Photoshop.exe"
VALUE "ProductName", "Adobe Photoshop CS"
VALUE "ProductVersion", "CS"
}
}

BLOCK "VarFileInfo"
{
VALUE "Translation", 0x0409 0x04B0
}
}

------------------------------------------------------------------------------

1 VERSIONINFO
FILEVERSION 3,0,0,4
PRODUCTVERSION 3,0,0,4
FILEOS 0x4
FILETYPE 0x1
{
BLOCK "StringFileInfo"
{
BLOCK "040904b0"
{
VALUE "Comments", "***Try & Buy***"
VALUE "CompanyName", "Jasc Software Inc."
VALUE "FileDescription", "Animation Shop"
VALUE "FileVersion", "3.04 Release Try & Buy"
VALUE "InternalName", "ANIM3"
VALUE "LegalCopyright", "Copyright © 1991-2000 Jasc Software Inc."
VALUE "LegalTrademarks", "Jasc Software, Inc."
VALUE "OriginalFilename", "ANIM.EXE"
VALUE "PrivateBuild", "8"
VALUE "ProductName", "Animation Shop 3"
VALUE "ProductVersion", "3.04"
VALUE "SpecialBuild", "Try & Buy Version, Unlicensed trial time limited to 30 days"
}
}

BLOCK "VarFileInfo"
{
VALUE "Translation", 0x0409 0x04B0
}

-------------------------------------------------------------------------------------

1 VERSIONINFO
FILEVERSION 1,4,0,0
PRODUCTVERSION 1,4,0,0
FILEOS 0x40004
FILETYPE 0x1
{
BLOCK "StringFileInfo"
{
BLOCK "000004b0"
{
VALUE "CompanyName", "Nikolaus Brennig"
VALUE "FileDescription", "Brennig's"
VALUE "FileVersion", "1.4"
VALUE "InternalName", "BGS"
VALUE "LegalCopyright", "Copyright © 2004 Nikolaus Brennig."
VALUE "OriginalFilename", "bgs.exe"
VALUE "ProductName", "Brennig's"
VALUE "ProductVersion", "1.4"
}
}

BLOCK "VarFileInfo"
{
VALUE "Translation", 0x0000 0x04B0
}
}


Exemple de file RC d'une boîte de dialogue

#include "resource.h"

#define IDC_EDIT              3000
#define IDC_BUTTON            3001
#define IDC_EXIT              3002

#define IDM_GETTEXT           32000
#define IDM_CLEAR             32001
#define IDM_EXIT              32003

MyDialog DIALOG 10, 10, 205, 60
STYLE 0x0004 | DS_CENTER | WS_CAPTION | WS_MINIMIZEBOX |
WS_SYSMENU | WS_VISIBLE | WS_OVERLAPPED | DS_MODALFRAME | DS_3DLOOK
CAPTION "Our First Dialog Box"
CLASS "DLGCLASS"
BEGIN
    EDITTEXT         IDC_EDIT,   15,17,111,13, ES_AUTOHSCROLL | ES_LEFT
    DEFPUSHBUTTON   "Dis Bonjour", IDC_BUTTON,    141,10,52,13
    PUSHBUTTON      "E&xit", IDC_EXIT,  141,26,52,13, WS_GROUP
END

MyMenu  MENU
BEGIN
    POPUP "Test Controls"
    BEGIN
        MENUITEM "Get Text", IDM_GETTEXT
        MENUITEM "Clear Text", IDM_CLEAR
        MENUITEM "", , 0x0800 /*MFT_SEPARATOR*/
        MENUITEM "E&xit", IDM_EXIT
    END
END


/*----------------------------
   POPMENU.RC resource script
  ----------------------------*/

#define IDM_NEW		1
#define IDM_OPEN	2
#define IDM_SAVE	3
#define IDM_SAVEAS	4

#define IDM_UNDO	5
#define IDM_CUT		6
#define IDM_COPY	7
#define IDM_PASTE	8
#define IDM_CLEAR	9

#define IDM_MAIN	10
#define IDM_EDIT	11
#define IDM_FILE	12

PopMenu MENU
{
  POPUP ""
  {
    POPUP "&File"
    {
      MENUITEM "&New",                  IDM_NEW
      MENUITEM "&Open",                 IDM_OPEN
      MENUITEM "&Save",                 IDM_SAVE
      MENUITEM "Save &As",              IDM_SAVEAS
      MENUITEM SEPARATOR
      MENUITEM "E&xit",                 IDM_EXIT
    }
    POPUP "&Edit"
    {
      MENUITEM "&Undo",                 IDM_UNDO
      MENUITEM SEPARATOR
      MENUITEM "Cu&t",                  IDM_CUT
      MENUITEM "&Copy",                 IDM_COPY
      MENUITEM "&Paste",                IDM_PASTE
      MENUITEM "C&lear",                IDM_CLEAR
    }
    POPUP "&Background"
    {
      MENUITEM "&White",                IDM_WHITE, CHECKED
      MENUITEM "&Lt Gray",              IDM_LTGRAY
      MENUITEM "&Gray",                 IDM_GRAY
      MENUITEM "&Dk Gray",              IDM_DKGRAY
      MENUITEM "&Black",                IDM_BLACK
    }
    POPUP "&Help"
    {
      MENUITEM "&Help",                 IDM_HELP
      MENUITEM "&About PopMenu...",     IDM_ABOUT
    }
  }
}


Exemple.RC dans Microsoft Visual C++

// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#include "richedit.h"
#undef APSTUDIO_HIDDEN_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (United States) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

/////////////////////////////////////////////////////////////////////////////
//
// RT_MANIFEST
//

1                       RT_MANIFEST             "../src/res/Win32++.manifest"

/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDW_MAIN                ICON                    "../src/res/Dialog.ico"

/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//

IDB_BITMAP1             BITMAP                  "../src/res/Zapotec.bmp"

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_DIALOG1 DIALOGEX 0, 0, 320, 200
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE |
    WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "My Dialog"
//FONT 8, "MS Shell Dlg", 0, 0, 0x1
FONT 8, "MS Shell Dlg", 0, 0
BEGIN
    DEFPUSHBUTTON   "OK",IDOK,241,153,50,16
    CONTROL         "Radio1",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,30,24,38,
                    10
    CONTROL         "Radio2",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,30,36,38,
                    10
    CONTROL         "Radio3",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,30,48,38,
                    10
    EDITTEXT        IDC_EDIT1,120,82,84,35,ES_MULTILINE | ES_AUTOHSCROLL |
                    NOT WS_BORDER,WS_EX_STATICEDGE
    CONTROL         "Check Box 1",IDC_CHECK1,"Button",BS_AUTOCHECKBOX |
                    WS_TABSTOP,30,114,55,10
    CONTROL         "Check Box 2",IDC_CHECK2,"Button",BS_AUTOCHECKBOX |
                    WS_TABSTOP,30,126,55,10
    CONTROL         "Check Box 3",IDC_CHECK3,"Button",BS_AUTOCHECKBOX |
                    WS_TABSTOP,30,139,55,10
    LISTBOX         IDC_LIST1,120,23,84,35,LBS_SORT | LBS_NOINTEGRALHEIGHT |
                    NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
    PUSHBUTTON      "Button",IDC_BUTTON1,30,82,49,11
    CONTROL         "",IDC_RICHEDIT1,RICHEDIT_CLASS,ES_MULTILINE |
                    ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP,120,142,84,35
    CONTROL         IDB_BITMAP1,IDC_STATIC1,"Static",SS_BITMAP,231,7,64,59
    GROUPBOX        "Static Window",IDC_STATIC2,226,78,78,51,BS_CENTER
    LTEXT           "Actions are displayed here",IDC_STATIC3,229,91,71,35
END

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE
BEGIN
    "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
    "#include ""windows.h""\r\n"
    "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
    "\0"
END

3 TEXTINCLUDE
BEGIN
    "\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED

#endif    // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////


Exemple

#include ".\RES\resource.h"

//------------------------------------------------------------------------------------ DATA
1111 TEXT Res\DATA_LECOMPLE.TXT //
//------------------------------------------------------------------------------------ MCI midi
1001 TEXT .\..\RES\MIDI\RC_champagn.mid //
1002 TEXT .\..\RES\MIDI\RC_honymoon.mid //
1003 TEXT .\..\RES\MIDI\RC_sunflower.mid //
1004 TEXT .\..\RES\MIDI\RC_Winapi3.mid //
1005 TEXT .\..\RES\MIDI\M_Invention_BWV785.mid // Music intro
//------------------------------------------------------------------------------------ ICON
501 ICON .\RES\PAPI.ICO
//------------------------------------------------------------------------------------ WAVE
201 WAVE .\..\RES\SOUND\AVMI_Fem.wav //
202 WAVE .\..\RES\SOUND\bonjour.wav //
203 WAVE .\..\RES\SOUND\BOUCHON.wav // 3_Ko Bouchon Champ
204 WAVE .\..\RES\SOUND\CL_SNAP_2.WAV // 2_Ko Bruit du clavier
205 WAVE .\..\RES\SOUND\AVMI_A.wav //
206 WAVE .\..\RES\SOUND\AVMI_V.wav //
207 WAVE .\..\RES\SOUND\AVMI_M.wav //
208 WAVE .\..\RES\SOUND\AVMI_I.wav //
211 WAVE .\..\RES\SOUND\brique1.wav // 1_Ko pose de chiffre en rota
212 WAVE .\..\RES\SOUND\UNA.wav // 2_Ko rota
215 WAVE .\..\RES\SOUND\riot_bomb_exp.wav // 2_Ko type pavé numérique
//------------------------------------------------------------------------------------ MCI wave
2001 WAVE .\..\RES\SOUND\yodelD.wav // Vocalise Nestor
2002 WAVE .\..\RES\SOUND\MENU_OV.wav // Aplaudissement
2003 WAVE .\..\RES\SOUND\Fart_4.wav // P
2004 WAVE .\..\RES\SOUND\Fart_3.wav // P
2005 WAVE .\..\RES\SOUND\Fart_Short.wav // P
2006 WAVE .\..\RES\SOUND\TOUX.wav // Toux Nestor
2007 WAVE .\..\RES\SOUND\oups_A8.wav // Baillement Nestor
2008 WAVE .\..\RES\SOUND\CLICK.WAV // Mouse_Over
2009 WAVE .\..\RES\SOUND\P_GIGGLE_A.WAV // 13_Ko Fin de Temo 45sec Rigolade
//------------------------------------------------------------------------------------ Bitmap/Image

101 IMAGE D:\GRAPHIC\PAINTSHOP\PSP__AVMI\PSP__BonCOMPTE\BonCOMPTE_CADRE_1280x960.jpg //
102 BITMAP D:\GRAPHIC\PAINTSHOP\PSP__AVMI\PSP__NESTOR\NESTOR_HEAD_2200x210.bmp
103 BITMAP D:\GRAPHIC\PAINTSHOP\PSP__AVMI\PSP__BonCOMPTE\COMPOSANT_BonCOMPTE.bmp //
104 BITMAP .\RES\ADRESSE_COLOR_216x148.bmp
105 BITMAP D:\GRAPHIC\PAINTSHOP\PSP__AVMI\PSP__BonCOMPTE\BonCOMPTE_MENU_186x374.bmp //
106 BITMAP D:\GRAPHIC\PAINTSHOP\PSP__AVMI\PSP__BonCOMPTE\CHIFFRE_VERTICAL_704x44.bmp //
107 BITMAP D:\GRAPHIC\PAINTSHOP\PSP__AVMI\PSP__BonCOMPTE\CHIFFRE_PLAQUE_960x128.bmp //

//------------------------------------------------------------------------------------ MenuPOPUP
#define IDM_F1 1101
#define IDM_F5 1105
#define IDM_F6 1106
#define IDM_F7 1107
#define IDM_F8 1108
#define IDM_M 1109

PopupMenu MENU
BEGIN
POPUP "MUSIQUE"
BEGIN
MENUITEM "HELP\t F1" , IDM_F1
MENUITEM SEPARATOR
MENUITEM " MUSIQUE" , 455, GRAYED
MENUITEM "Champagn\t F5" , IDM_F5
MENUITEM "Honymoon\t F6" , IDM_F6
MENUITEM "Sunflower\t F7" , IDM_F7
MENUITEM "SugarCake\t F8" , IDM_F8
MENUITEM "Oui-Non\t M" , IDM_M , // CHECKED
MENUITEM " MUSIQUE" , 455, GRAYED
END
END
//----------------------------------------------------------------------------------- Dialogue BOX

#include <DIALOG_MODEL.inc>


*** Vu dans PINBALL.exe (flipper NT)***

    SPLASH_BITMAP BITMAP "Bitmap_1.bmp"

    MENU_1 MENU
    LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
    {
    POPUP "&Partie"
    {
        MENUITEM "&Nouvelle partie\tF2",  101
        MENUITEM "&Lancer la balle",  401
        MENUITEM "&Suspendre/Reprendre la partie\tF3",  402
        MENUITEM SEPARATOR
        MENUITEM "Meilleurs s&cores...",  103
        MENUITEM "&Démonstration",  404
        MENUITEM "&Quitter",  105
    }
    POPUP "&Options"
    {
        MENUITEM "P&lein écran\tF4",  403
        MENUITEM "Sélectionner un ta&bleau",  405
        POPUP "Ch&oisir les joueurs"
        {
            MENUITEM "&1 joueur",  408
            MENUITEM "&2 joueurs",  409
            MENUITEM "&3 joueurs",  410
            MENUITEM "&4 joueurs",  411
        }
        MENUITEM SEPARATOR
        MENUITEM "&Sons",  201
        MENUITEM "&Musique",  202
        MENUITEM SEPARATOR
        MENUITEM "Contrôl&es de jeu...\tF8",  406
    }
    POPUP "&?"
    {
        MENUITEM "&Rubriques d'aide\tF1",  301
        MENUITEM SEPARATOR
        MENUITEM "À &propos de Pinball 3D",  102
    }
    }

    DIALOG_1 DIALOG 18, 18, 157, 78
    STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
    CAPTION "À propos de"
    LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
    {
       CONTROL "Pinball 3D pour Windows", -1, STATIC, SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 11, 6, 135, 8
       CONTROL "Version 1.0", -1, STATIC, SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 40, 37, 76, 8
       CONTROL "ICON_1", -1, STATIC, SS_ICON | WS_CHILD | WS_VISIBLE, 69, 18, 16, 16
       CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 66, 60, 24, 12
    }

    DLG_HIGHSCORES DIALOG 20, 22, 274, 141
    STYLE DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_CAPTION | WS_SYSMENU
    CAPTION "Meilleurs scores"
    LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
    FONT 8, "MS Shell Dlg"
    {
       CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 109, 120, 50, 14
       CONTROL "Annuler", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 163, 120, 50, 14
       CONTROL "&Effacer", 112, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 217, 120, 50, 14
       CONTROL "Nom", 701, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 49, 7, 24, 8
       CONTROL "Score", 702, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 200, 7, 20, 8
       CONTROL "Rang", 703, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 13, 7, 20, 8
       CONTROL "1", 704, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 13, 31, 16, 12
       CONTROL "2", 705, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 13, 47, 16, 12
       CONTROL "3", 706, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 13, 63, 16, 12
       CONTROL "4", 707, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 13, 79, 16, 12
       CONTROL "5", 708, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 13, 95, 16, 12
       CONTROL "", 401, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 49, 31, 120, 12
       CONTROL "", 402, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 49, 47, 120, 12
       CONTROL "", 403, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 49, 63, 120, 12
       CONTROL "", 404, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 49, 79, 120, 12
       CONTROL "", 405, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 49, 95, 120, 12
       CONTROL "", 501, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 180, 31, 58, 12
       CONTROL "", 502, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 180, 47, 58, 12
       CONTROL "", 503, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 180, 63, 58, 12
       CONTROL "", 504, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 180, 79, 58, 12
       CONTROL "", 505, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 180, 95, 58, 12
       CONTROL "", 601, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_BORDER | WS_TABSTOP, 47, 29, 120, 12
       CONTROL "", 602, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_BORDER | WS_TABSTOP, 47, 45, 120, 12
       CONTROL "", 603, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_BORDER | WS_TABSTOP, 47, 61, 120, 12
       CONTROL "", 604, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_BORDER | WS_TABSTOP, 47, 77, 120, 12
       CONTROL "", 605, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_BORDER | WS_TABSTOP, 47, 93, 120, 12
       CONTROL "", 606, STATIC, SS_BLACKFRAME | WS_CHILD | WS_VISIBLE, 7, 21, 259, 92
    }

    EDIT_COMPONENTS DIALOG 0, 0, 353, 94
    STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION | WS_SYSMENU
    CAPTION "Modification des composants de Pinball à des fins de vérification uniquement"
    LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
    {
       CONTROL "", 100, LISTBOX, LBS_STANDARD | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 1, 12, 68, 79
       CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 81, 75, 41, 14
       CONTROL "", 103, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 136, 0, 175, 93
       CONTROL "", 130, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 141, 10, 34, 12
       CONTROL "", 131, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 141, 23, 34, 12
       CONTROL "", 132, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 141, 36, 34, 12
       CONTROL "", 133, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 141, 49, 34, 12
       CONTROL "", 134, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 141, 62, 34, 12
       CONTROL "", 135, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 141, 75, 34, 12
       CONTROL "Texte", 136, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 178, 12, 130, 8
       CONTROL "Texte", 137, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 178, 25, 130, 8
       CONTROL "Texte", 138, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 178, 38, 130, 8
       CONTROL "Texte", 139, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 178, 51, 130, 8
       CONTROL "Texte", 140, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 178, 64, 130, 8
       CONTROL "Texte", 141, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 178, 77, 130, 8
       CONTROL "", 149, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 142, 10, 38, 12
       CONTROL "", 150, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 142, 23, 38, 12
       CONTROL "", 151, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 142, 36, 38, 12
       CONTROL "", 152, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 142, 49, 38, 12
       CONTROL "", 153, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 142, 62, 38, 12
       CONTROL "", 154, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 142, 75, 38, 12
       CONTROL "1", 156, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 184, 12, 120, 8
       CONTROL "2", 157, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 184, 25, 120, 8
       CONTROL "3", 158, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 184, 38, 120, 8
       CONTROL "4", 159, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 184, 51, 120, 8
       CONTROL "5", 160, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 184, 64, 120, 8
       CONTROL "6", 161, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 184, 77, 120, 8
       CONTROL "Réinitialiser", 163, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 81, 56, 41, 12
       CONTROL "Texte", 164, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 146, 26, 162, 8
       CONTROL "Texte", 165, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 146, 54, 162, 8
       CONTROL "Texte", 166, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 146, 81, 162, 8
       CONTROL "Modifier...", 167, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 245, 10, 62, 14
       CONTROL "Modifier...", 168, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 245, 38, 62, 14
       CONTROL "Modifier...", 169, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 245, 65, 62, 14
       CONTROL "Effets audio", 170, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 74, 10, 58, 10
       CONTROL "Pesanteur", 171, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 73, 24, 59, 10
       CONTROL "Score", 172, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 73, 38, 40, 10
       CONTROL "Texte", 173, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 146, 13, 97, 8
       CONTROL "Texte", 174, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 146, 41, 97, 8
       CONTROL "Texte", 175, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 146, 68, 97, 8
       CONTROL "Composants :", 176, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 2, 3, 43, 8
    }

    KEYMAPPER DIALOG 2, 9, 322, 183
    STYLE DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION | WS_SYSMENU
    CAPTION "Contrôles de jeu de Pinball 3D"
    LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
    FONT 8, "MS Shell Dlg"
    {
       CONTROL "OK", 1, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 158, 155, 50, 14
       CONTROL "Annuler", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 212, 155, 50, 14
       CONTROL "Par &défaut", 501, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 266, 155, 50, 14
       CONTROL "&Flipper gauche", 901, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 20, 79, 62, 8
       CONTROL "", 401, COMBOBOX, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 89, 77, 53, 70
       CONTROL "Flipp&er droit", 902, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 177, 79, 62, 8
       CONTROL "", 402, COMBOBOX, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 246, 77, 53, 70
       CONTROL "&Bourrage à gauche", 904, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 20, 102, 62, 8
       CONTROL "", 404, COMBOBOX, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 89, 100, 53, 70
       CONTROL "B&ourrage à droite", 905, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 177, 102, 62, 8
       CONTROL "", 405, COMBOBOX, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 246, 100, 53, 70
       CONTROL "Bo&urrage en bas", 906, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 20, 127, 62, 8
       CONTROL "", 406, COMBOBOX, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 89, 125, 53, 70
       CONTROL "&Lanceur", 903, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 177, 127, 62, 8
       CONTROL "", 403, COMBOBOX, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 246, 125, 53, 70
       CONTROL "Pour modifier les contrôles de jeu, choisissez les options de contrôle que vous désirez, cliquez sur les boutons de liste déroulante pour modifier des touches spécifiques et cliquez sur OK.", 801, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 14, 17, 293, 16
       CONTROL "Pour restaurer les paramètres d'origine de 3D Pinball, choisissez Par défaut et cliquez sur OK. Pour utiliser les flèches du pavé numérique, vérifiez que Verr. Num. est désactivé.", 802, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 14, 38, 293, 16
       CONTROL "Options de contrôle", 908, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 7, 63, 308, 87
       CONTROL "Instructions", 909, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 7, 5, 308, 53
    }

    XXDLG_HIGHSCORES DIALOG 20, 22, 211, 116
    STYLE DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_CAPTION | WS_SYSMENU
    CAPTION "Meilleurs scores"
    LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
    {
       CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | BS_LEFTTEXT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 32, 97, 33, 14
       CONTROL "Annuler", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 89, 97, 33, 14
       CONTROL "&Effacer", 112, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 146, 97, 33, 14
       CONTROL "Nom", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 51, 8, 24, 8
       CONTROL "Score", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 160, 8, 20, 8
       CONTROL "Rang", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 15, 8, 20, 8
       CONTROL "1", -1, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 15, 28, 16, 12
       CONTROL "2", -1, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 15, 40, 16, 12
       CONTROL "3", -1, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 15, 52, 16, 12
       CONTROL "4", -1, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 15, 64, 16, 12
       CONTROL "5", -1, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 15, 76, 16, 12
       CONTROL "", 401, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 51, 28, 88, 12
       CONTROL "", 402, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 51, 40, 88, 12
       CONTROL "", 403, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 51, 52, 88, 12
       CONTROL "", 404, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 51, 64, 88, 12
       CONTROL "", 405, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 51, 76, 88, 12
       CONTROL "", 501, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 140, 28, 58, 12
       CONTROL "", 502, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 140, 40, 58, 12
       CONTROL "", 503, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 140, 52, 58, 12
       CONTROL "", 504, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 140, 64, 58, 12
       CONTROL "", 505, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 140, 76, 58, 12
       CONTROL "", 601, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_BORDER | WS_TABSTOP, 49, 26, 88, 12
       CONTROL "", 602, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_BORDER | WS_TABSTOP, 49, 38, 88, 12
       CONTROL "", 603, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_BORDER | WS_TABSTOP, 49, 50, 88, 12
       CONTROL "", 604, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_BORDER | WS_TABSTOP, 49, 62, 88, 12
       CONTROL "", 605, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_BORDER | WS_TABSTOP, 49, 74, 88, 12
       CONTROL "", -1, STATIC, SS_BLACKFRAME | WS_CHILD | WS_VISIBLE, 9, 22, 195, 69
    }

    XXKEYMAPPER DIALOG 2, 9, 277, 158
    STYLE DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION | WS_SYSMENU
    CAPTION "Contrôles de jeu de Pinball 3D"
    LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
    FONT 8, "MS Shell Dlg"
    {
       CONTROL "OK", 1, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 221, 84, 50, 14
       CONTROL "Annuler", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 221, 105, 50, 14
       CONTROL "Par défaut", 501, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 221, 127, 50, 14
       CONTROL "", 401, COMBOBOX, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 62, 82, 53, 70
       CONTROL "", 402, COMBOBOX, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 161, 82, 53, 70
       CONTROL "", 404, COMBOBOX, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 62, 105, 53, 70
       CONTROL "", 405, COMBOBOX, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 161, 105, 53, 70
       CONTROL "", 406, COMBOBOX, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 62, 130, 53, 70
       CONTROL "", 403, COMBOBOX, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 161, 130, 53, 70
       CONTROL "Lanceur", 811, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 129, 133, 29, 8
       CONTROL "Flipper droit", 807, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 119, 84, 40, 10
       CONTROL "Bourrage à gauche", 912, STATIC, SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 12, 102, 34, 19
       CONTROL "Bourrage à droite", 914, STATIC, SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 125, 102, 34, 19
       CONTROL "Pour modifier les contrôles de jeu, choisissez les options de contrôle que vous désirez, cliquez sur les boutons de liste déroulante pour modifier des touches spécifiques et cliquez sur OK.", 801, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 12, 10, 255, 24
       CONTROL "Pour restaurer les paramètres d'origine de 3D Pinball, choisissez Par défaut et cliquez sur OK. Pour utiliser les flèches du pavé numérique, vérifiez que Verr. Num. est désactivé.", 802, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 12, 35, 256, 25
       CONTROL "Options de contrôle", 908, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 5, 67, 214, 87
       CONTROL "Flipper gauche", 803, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 9, 84, 48, 8
       CONTROL "Instructions", 909, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 5, 2, 265, 62
       CONTROL "Bourrage en bas", 916, STATIC, SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 12, 127, 37, 19
    }

    STRINGTABLE
    LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
    {
    0,  "Nouvelle partie gagnée !"
    1,  "Bille bloquée"
    2,  "Cabestan\n%ld"
    3,  "Bonus obtenu\n%ld"
    4,  "Bonus activé"
    5,  "Armes renforcées"
    6,  "Moteur renforcé"
    7,  "Bonus augmenté de 1 million"
    8,  "Bille supplémentaire disponible\n%ld"
    9,  "Bille supplémentaire"
    10,     "Prix pour tir de réflexe\n%ld"
    11,     "Bataille finale gagnée"
    12,     "Bonus de l'hyper-espace\n%ld"
    13,     "Bonus de l'hyper-espace activé"
    14,     "Jackpot\n%ld"
    15,     "Jackpot activé"
    }

    STRINGTABLE
    LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
    {
    16,     "Billes multiples"
    17,     "Bonus de rampe"
    18,     "Lumière en plus"
    19,     "Bonus de rampe actif"
    20,     "Lumière désactivée"
    21,     "Tir d'adresse\n%ld"
    22,     "Partie suspendue\nF3=Reprise"
    23,     "Continuer"
    24,     "F2 Nouvelle partie"
    25,     "Attention..."
    26,     "Joueur 1"
    27,     "Joueur 2"
    28,     "Joueur 3"
    29,     "Joueur 4"
    30,     "Démo\nJoueur 1"
    31,     "Démo\nJoueur 2"
    }

    STRINGTABLE
    LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
    {
    32,     "Démo\nJoueur 3"
    33,     "Démo\nJoueur 4"
    34,     "Partie terminée"
    35,     "TILT !"
    36,     "Ce programme nécessite un microprocesseur 80386 ou ultérieur."
    37,     "80386 nécessaire"
    38,     "Pinball 3D pour Windows - Cadet de l'Espace"
    39,     "Une ou plusieurs commandes sont affectées à la même touche ;\npour de meilleures performances, n'affectez qu'une seule commande à chaque touche."
    40,     "Effacer les meilleurs scores ?"
    41,     "Confirmer"
    42,     "WAVEMIX.INF est manquant - Ce fichier devrait être dans le répertoire de Pinball !"
    43,     "Avertissement :"
    44,     "Réapprovisionnement du vaisseau"
    45,     "Centre de gravité"
    46,     "Avancer dans le temps"
    47,     "Remonter dans le temps"
    }

    STRINGTABLE
    LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
    {
    48,     "Maelström !"
    49,     "Repaire du ver géant"
    50,     "Paré au lancement"
    51,     "Indicateurs mis à jour"
    52,     "Bonus conservé"
    53,     "Trophée niveau 1"
    54,     "Trophée niveau 2"
    55,     "Trophée niveau 3"
    56,     "Multiplicateur de champ 2x"
    57,     "Multiplicateur de champ 3x"
    58,     "Multiplicateur de champ 5x"
    59,     "Multiplicateur de champ 10x"
    60,     "Exercices de tir"
    61,     "Essais de tir"
    62,     "Essais de rentrée"
    63,     "Science"
    }

    STRINGTABLE
    LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
    {
    64,     "Comète errante"
    65,     "Trou noir"
    66,     "Rayonnement spatial"
    67,     "Chasse aux virus"
    68,     "Menace extra-terrestre"
    69,     "Sauvetage"
    70,     "Récupération du satellite"
    71,     "Reconnaissance"
    72,     "Machine de la fin du monde"
    73,     "Peste cosmique"
    74,     "Secret"
    75,     "Distorsion du temps"
    76,     "Maelström"
    77,     "Mission acceptée\n%ld"
    78,     "Mission achevée\n%ld"
    79,     "%s Mission sélectionnée"
    }

    STRINGTABLE
    LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
    {
    80,     "Trou noir\n%ld"
    81,     "Gravité normale\n%ld"
    82,     "Centre de gravité\n%ld"
    83,     "Élévation au grade de %s"
    84,     "Élève officier"
    85,     "Enseigne de vaisseau"
    86,     "Lieutenant de vaisseau"
    87,     "Capitaine de corvette"
    88,     "Capitaine de frégate"
    89,     "Capitaine de vaisseau"
    90,     "Contre-amiral"
    91,     "Vice-amiral"
    92,     "Amiral"
    93,     "Repaire du ver géant ouvert"
    94,     "Bonus de crash\n%ld"
    95,     "Nouvelle bille"
    }

    STRINGTABLE
    LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
    {
    96,     "Redéploiement"
    97,     "Joueur 1, rejouez"
    98,     "Joueur 2, rejouez"
    99,     "Joueur 3, rejouez"
    100,    "Joueur 4, rejouez"
    101,    "Ce flipper Pinball 3D a été créé pour Microsoft par Maxis.\nPour obtenir plus d'informations, appelez le service Consommateurs\nd’Electronic Arts au 04 72 53 25 00 (France) ou de Maxis\nau (800)-336-2947 (États-Unis et Canada seulement).\nCopyright (c) 1995 Maxis."
    102,    "Pinball 3D a été créé pour Microsoft par Maxis. Copyright (c) 1995 Maxis."
    103,    "À propos de Pinball 3D"
    104,    "Visez les cibles pour choisir une mission"
    105,    "Réapprovisionnement du vaisseau"
    106,    "Rampe d'acceptation de la mission %s"
    107,    "Tirs sur champignons d'attaque\nrestants : %d"
    108,    "Essais de tir réussis"
    109,    "Mission abandonnée"
    110,    "Tirs restants : %d"
    111,    "Essais de tir réussis"
    }

    STRINGTABLE
    LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
    {
    112,    "Rentrées restantes : %d"
    113,    "Essais de rentrée réussis"
    114,    "Cibles automatiques\nrestantes : %d"
    115,    "Mission scientifique achevée"
    116,    "Avertissement -- Niveau de carburant bas"
    117,    "Remplissez les bancs de détresse droits"
    118,    "Lancement dans l'hyper-espace"
    119,    "Comète détruite"
    120,    "Entrez dans le repaire du ver géant"
    121,    "Rayonnement supprimé"
    122,    "Renforcement des champignons de tir"
    123,    "Entrez dans le trou noir"
    124,    "Trou noir supprimé"
    125,    "Cibles\nrestantes : %d"
    126,    "Xénomorphes détruits"
    127,    "Mettre à niveau les indicateurs"
    }

    STRINGTABLE
    LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
    {
    128,    "Lancement dans l'hyper-espace"
    129,    "Survivants"
    130,    "Extra-terrestres repoussés"
    131,    "Tirez sur les cibles de carburants"
    132,    "Tirs restants sur les champignons d'attaque\ndistants : %d"
    133,    "Satellite réparé"
    134,    "Accès aux couloirs\nrestants : %d"
    135,    "Tirez la bille dans la glissière de carburant"
    136,    "Inspection terminée"
    137,    "Accès dans couloirs extérieurs\nrestants : %d"
    138,    "Machine de la fin du monde détruite"
    139,    "Roulement des indicateurs : %d"
    140,    "Tirez sur le roulement de distorsion spatiale"
    141,    "Peste éliminée"
    142,    "Visez le repaire jaune du ver géant"
    143,    "Visez le repaire rouge du ver géant"
    }

    STRINGTABLE
    LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
    {
    144,    "Visez le repaire vert du ver géant"
    145,    "Plans récupérés"
    146,    "Tirs sur élastiques\nrestants : %d"
    147,    "Visez le gouffre de l'hyper-espace ou la rampe de lancement"
    148,    "Tirs sur cibles automatiques\nrestants : %d"
    149,    "Tirs sur cibles de points\nrestants : %d"
    150,    "Accès dans couloirs\nrestants : %d"
    151,    "Tirez la bille dans la glissière de carburant"
    152,    "Visez la rampe de lancement"
    153,    "Tirez sur les drapeaux"
    154,    "Visez le repaire du ver"
    155,    "Gouffre de l'hyper-espace pour terminer Maelström"
    156,    "pinball.mid"
    158,    "0 UseBitmapFont"
    159,    "65 tilt gauche du flipper"
    }

    STRINGTABLE
    LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
    {
    160,    "80 tilt droit du flipper"
    161,    "32 Plunger Key"
    162,    "88 Bump Left Key"
    163,    "79 secousse droite"
    164,    "38 Bump Bottom Key"
    165,    "Software\\Microsoft\\Plus!\\Pinball"
    166,    "SpaceCadet"
    167,    "1c7c22a0-9576-11ce-bf80-444553540000"
    168,    "PINBALL.DAT"
    169,    "Cadet de l'espace"
    170,    "Erreur :"
    171,    "Impossible de trouver d'autres flippers."
    172,    "Pinball 3D\nSpace Cadet"
    173,    "Élévation au grade de %s"
    174,    "Rétrogradé vers %s"
    175,    "Renforcement des champignons d'attaque"
    }

    STRINGTABLE
    LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
    {
    176,    "Remplissez les bancs de détresse gauches"
    177,    "Meilleurs scores"
    178,    "pinball.chm"
    179,    "Mémoire insuffisante pour exécuter Pinball 3D."
    180,    "Score du joueur 1\n%ld"
    181,    "Score du joueur 2\n%ld"
    182,    "Score du joueur 3\n%ld"
    183,    "Score du joueur 4\n%ld"
    184,    "Meilleur score 1\n%ld"
    185,    "Meilleur score 2\n%ld"
    186,    "Meilleur score 3\n%ld"
    187,    "Meilleur score 4\n%ld"
    188,    "Meilleur score 5\n%ld"
    189,    "255 255 255   (Couleur RGB de la police par défaut)"
    }

    PBMSG_FT RCDATA "RCData_1.bin"

    ICON_1 ICON "Icon_1.ico"

    1 VERSIONINFO
    FILEVERSION 5,1,2600,2180
    PRODUCTVERSION 5,1,2600,2180
    FILEOS 0x40004
    FILETYPE 0x1
    {
    BLOCK "StringFileInfo"
    {
        BLOCK "040C04B0"
        {
            VALUE "CompanyName", "Cinematronics"
            VALUE "FileDescription", "3D Pinball"
            VALUE "FileVersion", "5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)"
            VALUE "InternalName", "3D Pinball"
            VALUE "LegalCopyright", "Copyright © Cinematronics 1994,1995"
            VALUE "OriginalFilename", "PINBALL.EXE"
            VALUE "ProductName", "3D Pinball"
            VALUE "ProductVersion", "5.1.2600.2180"
        }
    }

    BLOCK "VarFileInfo"
    {
        VALUE "Translation", 0x040C 0x04B0
    }
    }

    1 24 "Data_1.bin"


Menu N°7 du logiciel éditeur TexPad.exe

7 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "&Edit"
{
    MENUITEM "P&roperties",  32946
    MENUITEM SEPARATOR
    MENUITEM "Cu&t",  57635
    MENUITEM "&Copy",  57634
    MENUITEM "&Paste",  57637
    MENUITEM SEPARATOR
    POPUP "Cut Ot&her"
    {
        MENUITEM "S&election Append",  32792
        MENUITEM "&Line",  32800
        MENUITEM "L&ine Append",  32801
        MENUITEM "&Word",  32958
        MENUITEM "W&ord Append",  32959
        MENUITEM "&Bookmarked lines",  32980
    }
    POPUP "Cop&y Other"
    {
        MENUITEM "S&election Append",  32793
        MENUITEM "&Line",  32983
        MENUITEM "L&ine Append",  32984
        MENUITEM "&Word",  32985
        MENUITEM "W&ord Append",  32986
        MENUITEM "&Bookmarked lines",  32981
        MENUITEM "As a &HTML page",  32989
        MENUITEM SEPARATOR
        MENUITEM "File &Name",  32987
    }
    POPUP "&Insert"
    {
        MENUITEM "Line &After",  32962
        MENUITEM "Line &Before",  32961
        MENUITEM "Pa&ge Break",  32965
        MENUITEM SEPARATOR
        MENUITEM "Paste as Bloc&k",  32956
        MENUITEM "Paste as L&ines",  32957
        MENUITEM "Paste &HTML",  32955
        MENUITEM SEPARATOR
        MENUITEM "&Statistics",  32776
        MENUITEM "File &Name",  32774
        MENUITEM "&Files...",  32794
        MENUITEM SEPARATOR
        MENUITEM "&Time",  32974
        MENUITEM "Short &Date",  32975
        MENUITEM "&Long Date",  32976
    }
    POPUP "De&lete"
    {
        MENUITEM "&Selection",  57632
        MENUITEM "&Line",  32803
        MENUITEM "&Word",  32804
        MENUITEM "&Bookmarked Lines",  32979
    }
    MENUITEM SEPARATOR
    POPUP "Ch&ange Case"
    {
        MENUITEM "&Invert Case",  32795
        MENUITEM "&Upper Case",  32796
        MENUITEM "&Lower Case",  32797
        MENUITEM "&Sentence Case",  32773
        MENUITEM "&Capitalize",  32798
    }
    POPUP "Transp&ose"
    {
        MENUITEM "Chars",  32789
        MENUITEM "&Words",  32788
    }
    POPUP "&Align"
    {
        MENUITEM "&Left",  32971
        MENUITEM "&Center",  32960
        MENUITEM "&Right",  32972
        MENUITEM "&Justify",  32973
    }
    MENUITEM SEPARATOR
    MENUITEM "Refor&mat",  32966
    MENUITEM SEPARATOR
    MENUITEM "&Block Select Mode",  32820
    MENUITEM "&Fill Block...",  32982
    MENUITEM SEPARATOR
    MENUITEM "S&pelling...",  33203
    MENUITEM "Toggle Boo&kmark",  32941
}
}


RC complet du logiciel éditeur TexPad.exe

OXOPTIONTREE_HIGHCONTRAST_IMAGELIST BITMAP "Bitmap_1.bmp"

OXOPTIONTREE_IMAGELIST BITMAP "Bitmap_2.bmp"

125 BITMAP "Bitmap_3.bmp"

1200 BITMAP "Bitmap_4.bmp"

1201 BITMAP "Bitmap_5.bmp"

1202 BITMAP "Bitmap_6.bmp"

1203 BITMAP "Bitmap_7.bmp"

1204 BITMAP "Bitmap_8.bmp"

1205 BITMAP "Bitmap_9.bmp"

1206 BITMAP "Bitmap_10.bmp"

1207 BITMAP "Bitmap_11.bmp"

1208 BITMAP "Bitmap_12.bmp"

1209 BITMAP "Bitmap_13.bmp"

1210 BITMAP "Bitmap_14.bmp"

1211 BITMAP "Bitmap_15.bmp"

1212 BITMAP "Bitmap_16.bmp"

1213 BITMAP "Bitmap_17.bmp"

1214 BITMAP "Bitmap_18.bmp"

1215 BITMAP "Bitmap_19.bmp"

1216 BITMAP "Bitmap_20.bmp"

1217 BITMAP "Bitmap_21.bmp"

1218 BITMAP "Bitmap_22.bmp"

2100 BITMAP "Bitmap_23.bmp"

2101 BITMAP "Bitmap_24.bmp"

2102 BITMAP "Bitmap_25.bmp"

2103 BITMAP "Bitmap_26.bmp"

2104 BITMAP "Bitmap_27.bmp"

19000 BITMAP "Bitmap_28.bmp"

20516 BITMAP "Bitmap_29.bmp"

20517 BITMAP "Bitmap_30.bmp"

20518 BITMAP "Bitmap_31.bmp"

20519 BITMAP "Bitmap_32.bmp"

20520 BITMAP "Bitmap_33.bmp"

20521 BITMAP "Bitmap_34.bmp"

20522 BITMAP "Bitmap_35.bmp"

20523 BITMAP "Bitmap_36.bmp"

20524 BITMAP "Bitmap_37.bmp"

20525 BITMAP "Bitmap_38.bmp"

20694 BITMAP "Bitmap_39.bmp"

23000 BITMAP "Bitmap_40.bmp"

23001 BITMAP "Bitmap_41.bmp"

30994 BITMAP "Bitmap_42.bmp"

30996 BITMAP "Bitmap_43.bmp"

2 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "&File"
{
    MENUITEM "&New",  57600
    MENUITEM "&Open...",  57601
    MENUITEM SEPARATOR
    POPUP "&Workspace"
    {
        MENUITEM "&Open...",  32780
        MENUITEM "&Save",  32781
        MENUITEM "Save &As...",  32783
        MENUITEM "&Close",  32782
        MENUITEM SEPARATOR
        MENUITEM "Recent Workspace",  33232
    }
    MENUITEM SEPARATOR
    MENUITEM "Mana&ge Files...",  32768
    MENUITEM SEPARATOR
    MENUITEM "Page Set&up...",  57605
    MENUITEM SEPARATOR
    MENUITEM "Recent File",  57616,  GRAYED
    MENUITEM SEPARATOR
    MENUITEM "E&xit",  57665
}
POPUP "&Search"
{
    MENUITEM "&Find In Files...",  32813
}
POPUP "&View"
{
    MENUITEM "&Status Bar",  59393
    MENUITEM "&Clip Library",  59396
    MENUITEM "&Document Selector",  59397
    MENUITEM "D&ocument Tabs",  32817
    MENUITEM SEPARATOR
    POPUP "&Toolbars"
    {
        MENUITEM "&Standard",  59398
        MENUITEM "&File",  59399
        MENUITEM "&Edit",  59400
        MENUITEM "Sea&rch",  59401
        MENUITEM "&Macros",  59402
        MENUITEM "&Tools",  59403
        MENUITEM "&Window",  59404
        MENUITEM SEPARATOR
        MENUITEM "&Customize...",  32816
    }
    MENUITEM SEPARATOR
    MENUITEM "&Vertical Scroll Bar",  32822
    MENUITEM "&Horizontal Scroll Bar",  32821
    MENUITEM "&Line Numbers",  32945
    MENUITEM "V&isible Spaces",  32940
}
POPUP "&Tools"
{
    MENUITEM "&Compare Files...",  32848
    MENUITEM "&Explorer",  32849
    MENUITEM SEPARATOR
    MENUITEM "&Stop",  32851
    MENUITEM "&Run...",  32850
    MENUITEM SEPARATOR
    MENUITEM "&User Tool",  32854,  GRAYED
}
POPUP "&SConfigure"
{
    MENUITEM "&Preferences...",  32815
    MENUITEM "New Document &Class...",  33205
}
POPUP "&Help"
{
    MENUITEM "&Help Topics",  57667
    MENUITEM SEPARATOR
    MENUITEM "&Technical Support",  33207
    MENUITEM "Frequently Asked &Questions",  33209
    MENUITEM "TextPad on the &Web",  33212
    MENUITEM "Update &License...",  33206
    MENUITEM "&Ordering Information",  33208
    MENUITEM SEPARATOR
    MENUITEM "Tip of the &Day",  33210
    MENUITEM SEPARATOR
    MENUITEM "&About TextPad...",  57664
}
}

3 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "&File"
{
    MENUITEM "&New",  57600
    MENUITEM "&Open...",  57601
    MENUITEM "&Close",  57602
    MENUITEM "Clos&e All",  32785
    MENUITEM SEPARATOR
    MENUITEM "&Save",  57603
    MENUITEM "Save &As...",  57604
    MENUITEM "Save A&ll",  32786
    MENUITEM "&Revert",  32772
    MENUITEM "Rena&me...",  32775
    MENUITEM SEPARATOR
    POPUP "&Workspace"
    {
        MENUITEM "&Open...",  32780
        MENUITEM "&Save",  32781
        MENUITEM "Save &As...",  32783
        MENUITEM "&Close",  32782
        MENUITEM SEPARATOR
        MENUITEM "Recent Workspace",  33232
    }
    MENUITEM SEPARATOR
    MENUITEM "Mana&ge Files...",  32768
    MENUITEM SEPARATOR
    MENUITEM "&Print...",  57607
    MENUITEM "Print Pre&view",  57609
    MENUITEM "Page Set&up...",  57605
    MENUITEM SEPARATOR
    MENUITEM "Sen&d...",  57612
    MENUITEM SEPARATOR
    MENUITEM "Recent File",  57616,  GRAYED
    MENUITEM SEPARATOR
    MENUITEM "E&xit",  57665
}
POPUP "&Edit"
{
    MENUITEM "&Undo",  57643
    MENUITEM "&Redo",  57644
    MENUITEM SEPARATOR
    MENUITEM "Cu&t",  57635
    MENUITEM "&Copy",  57634
    MENUITEM "&Paste",  57637
    MENUITEM SEPARATOR
    POPUP "Cut Ot&her"
    {
        MENUITEM "S&election Append",  32792
        MENUITEM "&Line",  32800
        MENUITEM "L&ine Append",  32801
        MENUITEM "&Word",  32958
        MENUITEM "W&ord Append",  32959
        MENUITEM "&Bookmarked lines",  32980
    }
    POPUP "Cop&y Other"
    {
        MENUITEM "S&election Append",  32793
        MENUITEM "&Line",  32983
        MENUITEM "L&ine Append",  32984
        MENUITEM "&Word",  32985
        MENUITEM "W&ord Append",  32986
        MENUITEM "&Bookmarked lines",  32981
        MENUITEM "As a &HTML page",  32989
        MENUITEM SEPARATOR
        MENUITEM "File &Name",  32987
        MENUITEM "&All File Names",  32988
    }
    POPUP "&Insert"
    {
        MENUITEM "Line &After",  32962
        MENUITEM "Line &Before",  32961
        MENUITEM "&Page Break",  32965
        MENUITEM SEPARATOR
        MENUITEM "Paste as Bloc&k",  32956
        MENUITEM "Paste as L&ines",  32957
        MENUITEM "Paste &HTML",  32955
        MENUITEM SEPARATOR
        MENUITEM "&Statistics",  32776
        MENUITEM "File &Name",  32774
        MENUITEM "&Files...",  32794
        MENUITEM SEPARATOR
        MENUITEM "&Time",  32974
        MENUITEM "Short &Date",  32975
        MENUITEM "&Long Date",  32976
    }
    POPUP "De&lete"
    {
        MENUITEM "&Selection",  57632
        MENUITEM "&Line",  32803
        MENUITEM "&Word",  32804
        MENUITEM "&Bookmarked Lines",  32979
    }
    MENUITEM SEPARATOR
    POPUP "Chan&ge Case"
    {
        MENUITEM "&Invert Case",  32795
        MENUITEM "&Upper Case",  32796
        MENUITEM "&Lower Case",  32797
        MENUITEM "&Sentence Case",  32773
        MENUITEM "&Capitalize",  32798
    }
    POPUP "Transp&ose"
    {
        MENUITEM "Chars",  32789
        MENUITEM "&Words",  32788
    }
    POPUP "&Align"
    {
        MENUITEM "&Left",  32971
        MENUITEM "&Center",  32960
        MENUITEM "&Right",  32972
        MENUITEM "&Justify",  32973
    }
    MENUITEM SEPARATOR
    MENUITEM "Increase I&ndent",  32791
    MENUITEM "Reduce In&dent",  32790
    MENUITEM SEPARATOR
    MENUITEM "&Join Lines",  32967
    MENUITEM "Refor&mat",  32966
    MENUITEM SEPARATOR
    MENUITEM "&Fill Block...",  32982
    MENUITEM SEPARATOR
    MENUITEM "&Select All",  57642
    MENUITEM "Mar&k Clean",  32802
}
POPUP "&Search"
{
    MENUITEM "&Find...",  32806
    MENUITEM "Find &Next",  32807
    MENUITEM "Find &Previous",  32808
    MENUITEM "Find &In Files...",  32813
    MENUITEM SEPARATOR
    MENUITEM "&Replace...",  32809
    MENUITEM "Replace Ne&xt",  32810
    MENUITEM SEPARATOR
    MENUITEM "&Go To...",  32811
    MENUITEM SEPARATOR
    MENUITEM "Jump Nex&t",  32953
    MENUITEM "&Jump Previous",  32954
    MENUITEM SEPARATOR
    MENUITEM "Toggle &Bookmark",  32941
    MENUITEM "N&ext Bookmark",  32942
    MENUITEM "Pre&vious Bookmark",  32943
    MENUITEM "Invert &All Bookmarks",  32947
    MENUITEM "&Clear All Bookmarks",  32944
    MENUITEM SEPARATOR
    MENUITEM "&Match Bracket",  32812
}
POPUP "&View"
{
    MENUITEM "&Status Bar",  59393
    MENUITEM "&Clip Library",  59396
    MENUITEM "&Document Selector",  59397
    MENUITEM "D&ocument Tabs",  32817
    MENUITEM "&Full Screen",  32818
    MENUITEM SEPARATOR
    POPUP "&Toolbars"
    {
        MENUITEM "&Standard",  59398
        MENUITEM "&File",  59399
        MENUITEM "&Edit",  59400
        MENUITEM "Sea&rch",  59401
        MENUITEM "&Macros",  59402
        MENUITEM "&Tools",  59403
        MENUITEM "&Window",  59404
        MENUITEM SEPARATOR
        MENUITEM "&Customize...",  32816
    }
    MENUITEM SEPARATOR
    MENUITEM "&Vertical Scroll Bar",  32822
    MENUITEM "&Horizontal Scroll Bar",  32821
    MENUITEM "&Line Numbers",  32945
    MENUITEM "V&isible Spaces",  32940
    MENUITEM SEPARATOR
    MENUITEM "In Web &Browser",  33200
    MENUITEM SEPARATOR
    MENUITEM "Document &Properties",  32946
}
POPUP "&Tools"
{
    MENUITEM "&Compare Files...",  32848
    MENUITEM "S&pelling...",  33203
    MENUITEM "&Sort...",  32852
    MENUITEM "Con&vert",  32853
    MENUITEM "&Explorer",  32849
    MENUITEM SEPARATOR
    MENUITEM "S&top",  32851
    MENUITEM "&Run...",  32850
    MENUITEM SEPARATOR
    MENUITEM "&User Tool",  32854,  GRAYED
}
POPUP "&Macros"
{
    MENUITEM "&Record",  33104
    MENUITEM "Paus&e",  33105
    MENUITEM "&Playback",  33106
    MENUITEM "&Multi-play...",  33107
    MENUITEM "&Save...",  33108
    MENUITEM SEPARATOR
    MENUITEM "User macro",  33109
}
POPUP "&Configure"
{
    MENUITEM "&Block Select Mode",  32820
    MENUITEM "&Word Wrap",  32819
    MENUITEM "&Read Only",  32814
    MENUITEM "&Synchronize Scrolling",  33202
    MENUITEM "Enable &Undo",  33204
    MENUITEM SEPARATOR
    MENUITEM "New Document &Class...",  33205
    MENUITEM SEPARATOR
    MENUITEM "&Preferences...",  32815
}
POPUP "&Window"
{
    MENUITEM "&Split",  57653
    MENUITEM "Tile &Horizontally",  57651
    MENUITEM "Tile &Vertically",  57652
    MENUITEM "&Cascade",  57650
    MENUITEM "Arrange &Icons",  57649
    MENUITEM SEPARATOR
    MENUITEM "S&earch Results",  32949
    MENUITEM "C&ommand Results",  32950
}
POPUP "&Help"
{
    MENUITEM "&Help Topics",  57667
    MENUITEM SEPARATOR
    MENUITEM "&Technical Support",  33207
    MENUITEM "Frequently Asked &Questions",  33209
    MENUITEM "TextPad on the &Web",  33212
    MENUITEM "Update &License...",  33206
    MENUITEM "&Ordering Information",  33208
    MENUITEM SEPARATOR
    MENUITEM "Tip of the &Day",  33210
    MENUITEM SEPARATOR
    MENUITEM "&About TextPad...",  57664
}
}

4 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "&File"
{
    MENUITEM "&New",  57600
    MENUITEM "&Open...",  57601
    MENUITEM "&Close",  57602
    MENUITEM "Clos&e All",  32785
    MENUITEM "Save A&ll",  32786
    MENUITEM SEPARATOR
    POPUP "&Workspace"
    {
        MENUITEM "&Open...",  32780
        MENUITEM "&Save",  32781
        MENUITEM "Save &As...",  32783
        MENUITEM "&Close",  32782
        MENUITEM SEPARATOR
        MENUITEM "Recent Workspace",  33232
    }
    MENUITEM SEPARATOR
    MENUITEM "Mana&ge Files...",  32768
    MENUITEM SEPARATOR
    MENUITEM "&Print...",  57607
    MENUITEM "Print Pre&view",  57609
    MENUITEM "Page Set&up...",  57605
    MENUITEM SEPARATOR
    MENUITEM "Sen&d...",  57612
    MENUITEM SEPARATOR
    MENUITEM "Recent File",  57616,  GRAYED
    MENUITEM SEPARATOR
    MENUITEM "E&xit",  57665
}
POPUP "&Edit",  GRAYED
{
    MENUITEM "&Copy",  57634
    MENUITEM "Copy &Append",  32793
    MENUITEM SEPARATOR
    MENUITEM "Copy File &Name",  32987
    MENUITEM "&All File Names",  32988
}
POPUP "&Search"
{
    MENUITEM "&Find...",  32806
    MENUITEM "Find &Next",  32807
    MENUITEM "Find &Previous",  32808
    MENUITEM "Find &In Files...",  32813
    MENUITEM SEPARATOR
    MENUITEM "&Go To...",  32811
    MENUITEM SEPARATOR
    MENUITEM "Jump Nex&t",  32953
    MENUITEM "&Jump Previous",  32954
    MENUITEM SEPARATOR
    MENUITEM "Toggle &Bookmark",  32941
    MENUITEM "N&ext Bookmark",  32942
    MENUITEM "Pre&vious Bookmark",  32943
    MENUITEM "Invert &All Bookmarks",  32947
    MENUITEM "&Clear All Bookmarks",  32944
}
POPUP "&View"
{
    MENUITEM "&Status Bar",  59393
    MENUITEM "Clip &Library",  59396
    MENUITEM "&Document Selector",  59397
    MENUITEM "D&ocument Tabs",  32817
    MENUITEM "&Full Screen",  32818
    MENUITEM SEPARATOR
    POPUP "&Toolbars"
    {
        MENUITEM "&Standard",  59398
        MENUITEM "&File",  59399
        MENUITEM "&Edit",  59400
        MENUITEM "Sea&rch",  59401
        MENUITEM "&Macros",  59402
        MENUITEM "&Tools",  59403
        MENUITEM "&Window",  59404
        MENUITEM SEPARATOR
        MENUITEM "&Customize...",  32816
    }
    MENUITEM SEPARATOR
    MENUITEM "&Vertical Scroll Bar",  32822
    MENUITEM "&Horizontal Scroll Bar",  32821
    MENUITEM SEPARATOR
    MENUITEM "Document &Properties",  32946
}
POPUP "&Tools"
{
    MENUITEM "&Compare Files...",  32848
    MENUITEM "&Explorer",  32849
    MENUITEM SEPARATOR
    MENUITEM "&Stop",  32851
    MENUITEM "&Run...",  32850
    MENUITEM SEPARATOR
    MENUITEM "&User Tool",  32854,  GRAYED
}
POPUP "&Configure"
{
    MENUITEM "&Synchronize Scrolling",  33202
    MENUITEM SEPARATOR
    MENUITEM "&Preferences...",  32815
}
POPUP "&Window"
{
    MENUITEM "&Split",  57653
    MENUITEM "Tile &Horizontally",  57651
    MENUITEM "Tile &Vertically",  57652
    MENUITEM "&Cascade",  57650
    MENUITEM "Arrange &Icons",  57649
    MENUITEM SEPARATOR
    MENUITEM "S&earch Results",  32949
    MENUITEM "C&ommand Results",  32950
}
POPUP "&Help"
{
    MENUITEM "&Help Topics",  57667
    MENUITEM SEPARATOR
    MENUITEM "&Technical Support",  33207
    MENUITEM "Frequently Asked &Questions",  33209
    MENUITEM "TextPad on the &Web",  33212
    MENUITEM "Update &License...",  33206
    MENUITEM "&Ordering Information",  33208
    MENUITEM SEPARATOR
    MENUITEM "Tip of the &Day",  33210
    MENUITEM SEPARATOR
    MENUITEM "&About TextPad...",  57664
}
}

7 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "&Edit"
{
    MENUITEM "P&roperties",  32946
    MENUITEM SEPARATOR
    MENUITEM "Cu&t",  57635
    MENUITEM "&Copy",  57634
    MENUITEM "&Paste",  57637
    MENUITEM SEPARATOR
    POPUP "Cut Ot&her"
    {
        MENUITEM "S&election Append",  32792
        MENUITEM "&Line",  32800
        MENUITEM "L&ine Append",  32801
        MENUITEM "&Word",  32958
        MENUITEM "W&ord Append",  32959
        MENUITEM "&Bookmarked lines",  32980
    }
    POPUP "Cop&y Other"
    {
        MENUITEM "S&election Append",  32793
        MENUITEM "&Line",  32983
        MENUITEM "L&ine Append",  32984
        MENUITEM "&Word",  32985
        MENUITEM "W&ord Append",  32986
        MENUITEM "&Bookmarked lines",  32981
        MENUITEM "As a &HTML page",  32989
        MENUITEM SEPARATOR
        MENUITEM "File &Name",  32987
    }
    POPUP "&Insert"
    {
        MENUITEM "Line &After",  32962
        MENUITEM "Line &Before",  32961
        MENUITEM "Pa&ge Break",  32965
        MENUITEM SEPARATOR
        MENUITEM "Paste as Bloc&k",  32956
        MENUITEM "Paste as L&ines",  32957
        MENUITEM "Paste &HTML",  32955
        MENUITEM SEPARATOR
        MENUITEM "&Statistics",  32776
        MENUITEM "File &Name",  32774
        MENUITEM "&Files...",  32794
        MENUITEM SEPARATOR
        MENUITEM "&Time",  32974
        MENUITEM "Short &Date",  32975
        MENUITEM "&Long Date",  32976
    }
    POPUP "De&lete"
    {
        MENUITEM "&Selection",  57632
        MENUITEM "&Line",  32803
        MENUITEM "&Word",  32804
        MENUITEM "&Bookmarked Lines",  32979
    }
    MENUITEM SEPARATOR
    POPUP "Ch&ange Case"
    {
        MENUITEM "&Invert Case",  32795
        MENUITEM "&Upper Case",  32796
        MENUITEM "&Lower Case",  32797
        MENUITEM "&Sentence Case",  32773
        MENUITEM "&Capitalize",  32798
    }
    POPUP "Transp&ose"
    {
        MENUITEM "Chars",  32789
        MENUITEM "&Words",  32788
    }
    POPUP "&Align"
    {
        MENUITEM "&Left",  32971
        MENUITEM "&Center",  32960
        MENUITEM "&Right",  32972
        MENUITEM "&Justify",  32973
    }
    MENUITEM SEPARATOR
    MENUITEM "Refor&mat",  32966
    MENUITEM SEPARATOR
    MENUITEM "&Block Select Mode",  32820
    MENUITEM "&Fill Block...",  32982
    MENUITEM SEPARATOR
    MENUITEM "S&pelling...",  33203
    MENUITEM "Toggle Boo&kmark",  32941
}
}

8 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "&Settings"
{
    MENUITEM "&Properties",  32946
    MENUITEM SEPARATOR
    MENUITEM "&Toggle Bookmark",  32941
}
}

9 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "&Log"
{
    MENUITEM "&Properties",  32946
    MENUITEM SEPARATOR
    MENUITEM "&Clear All",  57633
    MENUITEM "&Open All",  33201
    MENUITEM "&Toggle Bookmark",  32941
    MENUITEM SEPARATOR
    MENUITEM "&Block Select Mode",  32820
}
}

10 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "&Date/Time"
{
    MENUITEM "Insert &Time",  32974
    MENUITEM "Insert &Short Date",  32975
    MENUITEM "Insert &Long Date",  32976
}
}

11 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "Macro"
{
    MENUITEM "Properties",  33100
    MENUITEM "Add",  33101
    MENUITEM "Remove",  33102
    MENUITEM "Delete",  33103
}
}

12 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "Selector"
{
    MENUITEM "&Close",  57602
    MENUITEM "&Print",  32770
    MENUITEM SEPARATOR
    MENUITEM "Show &full paths",  32823
    MENUITEM SEPARATOR
    MENUITEM "P&roperties",  32946
}
}

13 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "Selector"
{
    MENUITEM "&Close document(s)",  57602
    MENUITEM "&Print document(s)",  32770
    MENUITEM SEPARATOR
    MENUITEM "Tile &horizontally",  57651
    MENUITEM "Tile &vertically",  57652
    MENUITEM SEPARATOR
    MENUITEM "P&roperties",  32946
    MENUITEM SEPARATOR
    MENUITEM "Show &full paths",  32823
    MENUITEM SEPARATOR
    MENUITEM "C&lose selector",  32829
}
}

14 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "Control bars"
{
    MENUITEM "Status &Bar",  59393
    MENUITEM "Clip &Library",  59396
    MENUITEM "&Document Selector",  59397
    MENUITEM "D&ocument Tabs",  32817
    MENUITEM SEPARATOR
    MENUITEM "&Standard",  59398
    MENUITEM "&File",  59399
    MENUITEM "&Edit",  59400
    MENUITEM "Sea&rch",  59401
    MENUITEM "&Macros",  59402
    MENUITEM "&Tools",  59403
    MENUITEM "&Window",  59404
    MENUITEM SEPARATOR
    MENUITEM "&Customize...",  32816
}
}

15 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "Tray"
{
    MENUITEM "&Restore",  32948
    MENUITEM "&Exit",  57665
}
}

16 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "Clip Library"
{
    MENUITEM "&Save book",  33216
    MENUITEM "&Rename book...",  33217
    MENUITEM "&Delete book",  33218
    MENUITEM "&Edit book",  33229
    MENUITEM SEPARATOR
    MENUITEM "&New book...",  33219
    MENUITEM "Re&fresh",  33220
    MENUITEM SEPARATOR
    MENUITEM "C&lose",  33221
}
}

17 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "Clip Book"
{
    MENUITEM "&Insert",  33222
    MENUITEM SEPARATOR
    MENUITEM "&Copy",  33223
    MENUITEM "&Edit",  33228
    MENUITEM "Re&name...",  33224
    MENUITEM "&Delete",  33225
    MENUITEM SEPARATOR
    MENUITEM "&Paste new entry...",  33226
    MENUITEM SEPARATOR
    MENUITEM "&Sort",  33227
    MENUITEM "&Refresh",  33220
    MENUITEM SEPARATOR
    MENUITEM "C&lose",  33221
}
}

18 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "Clipboard History"
{
    MENUITEM "&New book...",  33219
    MENUITEM "Re&fresh",  33220
    MENUITEM SEPARATOR
    MENUITEM "C&lose",  33221
}
}

19 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "Clipboard History Book"
{
    MENUITEM "&Insert",  33222
    MENUITEM "&Delete",  33225
    MENUITEM "&Clear all",  33230
    MENUITEM SEPARATOR
    MENUITEM "C&lose",  33221
}
}

20 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "Drop"
{
    MENUITEM "&Copy here",  33310
    MENUITEM "&Move here",  33311
    MENUITEM SEPARATOR
    MENUITEM "Cancel",  33312
}
}

21 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "History"
{
    MENUITEM "&Delete",  57632
    MENUITEM "Delete &all",  57633
    MENUITEM SEPARATOR
    MENUITEM "Cancel",  2
}
}

67 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "New Tool"
{
    MENUITEM "&Program...",  33300
    MENUITEM "&DOS Command...",  33301
    MENUITEM "Online &Help File...",  33302
    MENUITEM "Menu Separator",  33303
}
}

20620 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "ShortcutList Menu"
{
    MENUITEM "Large Icon",  43054
    MENUITEM "Small Icon",  43055
}
}

22 DIALOG 0, 0, 280, 0
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL 2, 188, STATIC, SS_ICON | WS_CHILD | WS_VISIBLE, 10, 7, 20, 20
   CONTROL "(Title/version)", 121, STATIC, SS_LEFT | SS_NOPREFIX | WS_CHILD | WS_VISIBLE, 38, 7, 233, 8
   CONTROL "(Copyright)", 122, STATIC, SS_LEFT | SS_NOPREFIX | WS_CHILD | WS_VISIBLE, 38, 16, 235, 8
   CONTROL "The Sentry Spelling-Checker Engine Copyright © 1993 Wintertree Software Inc.", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 38, 25, 235, 8
   CONTROL "All Rights Reserved", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 38, 34, 125, 8
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_CHILD | WS_VISIBLE, 38, 46, 150, 12
   CONTROL "Unlicensed Copy (fully functional)", 124, STATIC, SS_LEFT | SS_NOPREFIX | WS_CHILD | WS_VISIBLE | WS_GROUP, 38, 58, 235, 8
   CONTROL "For Evaluation Purposes Only", 125, STATIC, SS_LEFT | SS_NOPREFIX | WS_CHILD | WS_VISIBLE | WS_GROUP, 38, 67, 235, 8
   CONTROL "", 127, STATIC, SS_LEFT | SS_NOPREFIX | WS_CHILD | WS_VISIBLE | WS_GROUP, 38, 76, 235, 8
   CONTROL "", -1, STATIC, SS_BLACKRECT | WS_CHILD | WS_VISIBLE, 38, 93, 235, 1
   CONTROL "Disk Space:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 38, 103, 78, 8
   CONTROL "", 126, STATIC, SS_LEFT | SS_NOPREFIX | WS_CHILD | WS_VISIBLE, 108, 103, 86, 8
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 228, 100, 45, 14
   CONTROL "Ordering &Information...", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 190, 44, 83, 14
}

23 DIALOG 0, 0, 160, 0
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION
CAPTION ""
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 10, "MS Shell Dlg"
{
   CONTROL "", 100, STATIC, SS_BLACKRECT | WS_CHILD | WS_VISIBLE, 7, 57, 146, 1
   CONTROL "Version", 121, STATIC, SS_CENTER | SS_NOPREFIX | WS_CHILD | WS_VISIBLE, 10, 62, 140, 8
   CONTROL "Copyright", 122, STATIC, SS_CENTER | SS_NOPREFIX | WS_CHILD | WS_VISIBLE, 10, 72, 140, 8
   CONTROL "All Rights Reserved", 123, STATIC, SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 10, 82, 140, 8
}

24 DIALOG 0, 0, 0, 0
STYLE WS_POPUP | WS_CAPTION
CAPTION ""
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 10, "MS Shell Dlg"
{
}

25 DIALOG 0, 0, 282, 57
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Manage Files"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Working folder:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 6, 4, 67, 8
   CONTROL "", 121, STATIC, SS_LEFT | SS_NOPREFIX | WS_CHILD | WS_VISIBLE | WS_GROUP, 73, 4, 203, 8
   CONTROL "&Files:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 6, 20, 20, 8
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 26, 18, 250, 12
   CONTROL "&Copy...", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 6, 38, 40, 14
   CONTROL "&Delete", 152, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 52, 38, 40, 14
   CONTROL "&Rename...", 153, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 98, 38, 40, 14
   CONTROL "&Touch", 154, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 144, 38, 40, 14
   CONTROL "&Browse...", 155, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 190, 38, 40, 14
   CONTROL "C&lose", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 236, 38, 40, 14
}

26 DIALOG 20, 47, 284, 76
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Copy/Rename"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Working folder:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 67, 8
   CONTROL "", 121, STATIC, SS_LEFT | SS_NOPREFIX | WS_CHILD | WS_VISIBLE | WS_GROUP, 74, 7, 203, 8
   CONTROL "From:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 23, 20, 8
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 27, 21, 250, 12
   CONTROL "&To:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 38, 20, 8
   CONTROL "", 102, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 27, 38, 250, 12
   CONTROL "&OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 51, 55, 50, 14
   CONTROL "&Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 117, 55, 50, 14
   CONTROL "&Browse...", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 183, 55, 50, 14
}

27 DIALOG 20, 47, 284, 60
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Delete/Touch"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Working folder:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 67, 8
   CONTROL "", 121, STATIC, SS_LEFT | SS_NOPREFIX | WS_CHILD | WS_VISIBLE | WS_GROUP, 74, 7, 203, 8
   CONTROL "Delete:", 122, STATIC, SS_LEFT | SS_NOPREFIX | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 23, 29, 8
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 37, 21, 240, 12
   CONTROL "&OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 84, 39, 50, 14
   CONTROL "&Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 39, 50, 14
}

28 DIALOG 100, 100, 268, 115
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Find In Files"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "F&ind what:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 6, 6, 42, 8
   CONTROL "", 141, COMBOBOX, CBS_DROPDOWN | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_HASSTRINGS | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 49, 4, 167, 80
   CONTROL "In &files:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 6, 22, 42, 8
   CONTROL "", 142, COMBOBOX, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 49, 20, 167, 66
   CONTROL "In fol&der:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 6, 38, 42, 8
   CONTROL "", 143, COMBOBOX, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 49, 36, 167, 66
   CONTROL "Conditions:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 6, 51, 85, 59
   CONTROL "&Text", 271, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 10, 62, 37, 10
   CONTROL "He&x", 272, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 47, 62, 37, 10
   CONTROL "Match &whole words", 161, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 10, 74, 77, 10
   CONTROL "Match &case", 162, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 10, 85, 77, 10
   CONTROL "Regular &expression", 163, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 10, 96, 77, 10
   CONTROL "Report detail:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 97, 51, 119, 35
   CONTROL "&All matching lines", 275, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 102, 62, 111, 10
   CONTROL "File counts &only", 276, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 102, 72, 111, 10
   CONTROL "&Search subfolders", 164, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 97, 90, 118, 10
   CONTROL "&Binary files", 165, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 97, 100, 118, 10
   CONTROL "Find", 151, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 222, 3, 40, 13
   CONTROL "B&rowse...", 152, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 222, 27, 40, 13
   CONTROL "Close", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 222, 60, 40, 13
   CONTROL "Defa&ults", 153, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 222, 77, 40, 13
   CONTROL "&Help", -7866, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 222, 94, 40, 13
}

29 DIALOG 0, 0, 0, 0
STYLE WS_POPUP | WS_CAPTION
CAPTION ""
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 10, "MS Shell Dlg"
{
}

30 DIALOG 0, 0, 121, 100
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Go To"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 60, 21, 43, 12
   CONTROL "&Extend selection", 161, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 64, 107, 10
   CONTROL "Go To", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 79, 50, 14
   CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 64, 79, 50, 14
   CONTROL "&Line", 271, BUTTON, BS_RADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 7, 7, 50, 10
   CONTROL "&Column", 272, BUTTON, BS_RADIOBUTTON | WS_CHILD | WS_VISIBLE, 7, 17, 50, 10
   CONTROL "&Page", 273, BUTTON, BS_RADIOBUTTON | WS_CHILD | WS_VISIBLE, 7, 27, 50, 10
   CONTROL "&Byte", 274, BUTTON, BS_RADIOBUTTON | WS_CHILD | WS_VISIBLE, 7, 37, 50, 10
   CONTROL "&Next Bookmark", 275, BUTTON, BS_RADIOBUTTON | WS_CHILD | WS_VISIBLE, 7, 47, 107, 10
}

31 DIALOG 0, 0, 230, 62
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Choose File"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Folder:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 30, 8
   CONTROL "", 121, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 37, 7, 186, 8
   CONTROL "", 141, COMBOBOX, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 7, 23, 216, 84
   CONTROL "Yes", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 57, 41, 50, 14
   CONTROL "No", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 123, 41, 50, 14
}

33 DIALOGEX 0, 0, 244, 180
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Tools"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "List1", 135, "SysListView32", LVS_REPORT | LVS_SHOWSELALWAYS | LVS_OWNERDRAWFIXED | LVS_NOCOLUMNHEADER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 7, 16, 107, 157 , 0x00000200
   CONTROL "A&dd", 151, BUTTON, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 157, 7, 50, 14
   CONTROL "", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 121, 35, 116, 121
   CONTROL "Use this form to add, delete, rename or change the order of the tools you want to appear on the Tools menu.\n\nTo set the properties of a new tool, click Apply then select it in the tree control.", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 121, 35, 116, 121
}

34 DIALOG 0, 0, 244, 180
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION ""
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&Command:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 7, 9, 60, 10
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 68, 7, 169, 12
   CONTROL "&Parameters:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 7, 23, 60, 10
   CONTROL "", 102, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 68, 21, 169, 12
   CONTROL "&Initial folder:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 7, 37, 60, 10
   CONTROL "", 103, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 68, 35, 169, 12
   CONTROL "P&rompt for parameters", 161, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 7, 59, 111, 10
   CONTROL "Run &minimized", 162, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 7, 69, 111, 10
   CONTROL "&Save all documents first", 163, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 7, 79, 111, 10
   CONTROL "Capture &output", 164, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 120, 59, 118, 10
   CONTROL "S&uppress output until completed", 165, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 120, 69, 118, 10
   CONTROL "Sound alert &when completed", 166, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 120, 79, 118, 10
   CONTROL "Regular e&xpression to match output:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 7, 102, 230, 65
   CONTROL "", 104, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 14, 117, 216, 12
   CONTROL "Registers:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 14, 132, 216, 29
   CONTROL "&File:", -1, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 20, 145, 33, 8
   CONTROL "", 141, COMBOBOX, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 54, 143, 30, 40
   CONTROL "&Line:", -1, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 89, 145, 33, 8
   CONTROL "", 142, COMBOBOX, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 123, 143, 30, 40
   CONTROL "Colum&n:", -1, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 159, 145, 33, 8
   CONTROL "", 143, COMBOBOX, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 193, 143, 30, 50
}

35 DIALOG 115, 94, 236, 93
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Find"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "F&ind what:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 6, 8, 38, 10
   CONTROL "", 141, COMBOBOX, CBS_DROPDOWN | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_HASSTRINGS | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 47, 6, 128, 80
   CONTROL "Conditions:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 6, 20, 93, 67
   CONTROL "&Text", 271, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 11, 31, 40, 10
   CONTROL "He&x", 272, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 51, 31, 40, 10
   CONTROL "Match &whole words", 161, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 11, 43, 86, 10
   CONTROL "Match &case", 162, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 11, 53, 86, 10
   CONTROL "Regular &expression", 163, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 11, 63, 86, 10
   CONTROL "Wrap &searches", 164, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 11, 73, 86, 10
   CONTROL "Direction:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 105, 20, 69, 36
   CONTROL "&Up", 273, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 110, 31, 60, 10
   CONTROL "&Down", 274, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 110, 42, 60, 10
   CONTROL "Extend se&lection", 165, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 105, 64, 69, 10
   CONTROL "In &all documents", 166, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 105, 75, 69, 10
   CONTROL "&Find Next", 151, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 180, 6, 50, 13
   CONTROL "&Mark All", 152, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 180, 22, 50, 13
   CONTROL "Close", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 180, 44, 50, 13
   CONTROL "&Help", -7866, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 180, 60, 50, 13
}

36 DIALOG 115, 94, 237, 105
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Replace"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "F&ind what:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 6, 8, 47, 10
   CONTROL "", 141, COMBOBOX, CBS_DROPDOWN | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_HASSTRINGS | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 54, 6, 121, 80
   CONTROL "Re&place with:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 6, 25, 47, 10
   CONTROL "", 142, COMBOBOX, CBS_DROPDOWN | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_HASSTRINGS | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 54, 23, 121, 80
   CONTROL "Conditions:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 6, 38, 89, 59
   CONTROL "&Text", 271, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 11, 49, 40, 10
   CONTROL "He&x", 272, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 51, 49, 40, 10
   CONTROL "Match &whole words", 161, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 11, 61, 80, 10
   CONTROL "Match &case", 162, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 11, 72, 80, 10
   CONTROL "Regular &expression", 163, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 11, 83, 80, 10
   CONTROL "Scope:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 99, 38, 76, 59
   CONTROL "Active &document", 273, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 104, 51, 68, 10
   CONTROL "&Selected text", 274, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 104, 64, 68, 10
   CONTROL "A&ll documents", 275, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 104, 77, 68, 10
   CONTROL "&Find Next", 151, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 182, 6, 50, 13
   CONTROL "&Replace", 152, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 182, 21, 50, 13
   CONTROL "Replace &Next", 154, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 182, 36, 50, 13
   CONTROL "Replace &All", 153, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 182, 51, 50, 13
   CONTROL "Close", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 182, 69, 50, 13
   CONTROL "&Help", -7866, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 182, 84, 50, 13
}

37 DIALOG 0, 0, 0, 0
STYLE WS_POPUP | WS_CAPTION
CAPTION ""
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 10, "MS Shell Dlg"
{
}

38 DIALOG 0, 0, 234, 130
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Compare Text Files"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Current Folder:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 54, 10
   CONTROL "", 121, STATIC, SS_LEFT | SS_NOPREFIX | WS_CHILD | WS_VISIBLE | WS_GROUP, 62, 7, 165, 10
   CONTROL "&First File:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 7, 25, 54, 10
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 62, 24, 149, 12
   CONTROL "...", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 213, 23, 14, 14
   CONTROL "&Second File:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 7, 43, 54, 10
   CONTROL "", 102, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 62, 42, 149, 12
   CONTROL "...", 152, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 213, 41, 14, 14
   CONTROL "Ignore differences due to:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 7, 61, 219, 41
   CONTROL "&Upper and lower case letters", 161, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 14, 72, 210, 10
   CONTROL "&Number of spaces or tabs", 162, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 14, 86, 210, 10
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 26, 109, 50, 14
   CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 92, 109, 50, 14
   CONTROL "&Help", -7866, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 158, 109, 50, 14
}

39 DIALOG 0, 0, 235, 103
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Run"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&Command:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 7, 9, 54, 11
   CONTROL "", 141, COMBOBOX, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_OEMCONVERT | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 62, 7, 166, 60
   CONTROL "&Parameters:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 7, 24, 54, 10
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 62, 22, 166, 12
   CONTROL "&Initial folder:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 7, 39, 54, 10
   CONTROL "", 102, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 62, 37, 166, 12
   CONTROL "&DOS Command", 162, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 55, 107, 10
   CONTROL "Capture &Output", 163, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 120, 55, 107, 10
   CONTROL "Clos&e DOS window on exit", 164, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 67, 107, 10
   CONTROL "Run &Minimized", 161, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 120, 67, 107, 10
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 82, 50, 14
   CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 64, 82, 49, 14
   CONTROL "&Browse...", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 120, 82, 50, 14
   CONTROL "&Help", -7866, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 177, 82, 50, 14
}

42 DIALOG 0, 0, 220, 81
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Quick Open File"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Working folder:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 62, 10
   CONTROL "", 121, STATIC, SS_LEFT | SS_NOPREFIX | WS_CHILD | WS_VISIBLE | WS_GROUP, 69, 7, 144, 10
   CONTROL "&Name:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 24, 26, 10
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 34, 23, 179, 12
   CONTROL "&Search subfolders", 161, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 34, 42, 90, 12
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 19, 60, 50, 14
   CONTROL "&Browse", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 85, 60, 50, 14
   CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 151, 60, 50, 14
}

43 DIALOG 0, 0, 270, 139
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Document Class Wizard"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL 125, -1, STATIC, SS_BITMAP | WS_CHILD | WS_VISIBLE, 7, 7, 47, 56
   CONTROL "This wizard will help you to create a new document class for managing properties such as fonts, tab stops and syntax highlighting.", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 70, 7, 193, 25
   CONTROL "Document class &name:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 70, 65, 82, 8
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 154, 62, 109, 14
}

44 DIALOG 0, 0, 270, 139
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Document Class Wizard"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL 125, -1, STATIC, SS_BITMAP | WS_CHILD | WS_VISIBLE, 7, 7, 47, 56
   CONTROL "Please specify the members of this class with wild cards.  Use commas to separate each wild card.  (e.g. *.sql, *.sqr)", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 70, 7, 196, 25
   CONTROL "Class &members:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 70, 65, 85, 8
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 157, 62, 109, 14
}

45 DIALOG 0, 0, 270, 139
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Document Class Wizard"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL 125, -1, STATIC, SS_BITMAP | WS_CHILD | WS_VISIBLE, 7, 7, 47, 56
   CONTROL "If you would like documents of this class to be syntax highlighted, enable that option, and select a syntax definition file from the list.", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 70, 7, 196, 25
   CONTROL "&Enable syntax highlighting", 161, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 70, 39, 196, 10
   CONTROL "Syntax &definition file:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 70, 55, 173, 8
   CONTROL "", 141, COMBOBOX, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_OEMCONVERT | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_GROUP | WS_TABSTOP, 70, 65, 196, 71
   CONTROL "Additional syntax definition files are available from http://www.textpad.com/add-ons/", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 70, 95, 196, 33
}

46 DIALOG 0, 0, 270, 139
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Document Class Wizard"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL 125, -1, STATIC, SS_BITMAP | WS_CHILD | WS_VISIBLE, 7, 7, 47, 56
   CONTROL "The following document class will be created:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 70, 7, 196, 8
   CONTROL "Name:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 74, 22, 66, 8
   CONTROL "Static", 121, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 140, 22, 126, 8
   CONTROL "Members:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 74, 32, 66, 8
   CONTROL "Static", 122, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 140, 32, 126, 8
   CONTROL "Syntax definitions:", 124, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 74, 42, 66, 8
   CONTROL "Static", 123, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 140, 42, 126, 8
   CONTROL "Click Finish to create this document class.  You may subsequently modify its properties by choosing Preferences from the Configure menu, and selecting this class on the Preferences dialog box.", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 70, 95, 196, 33
}

47 DIALOG 0, 0, 230, 46
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Tool Parameters"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&Parameters:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 6, 8, 35, 10
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 46, 6, 180, 12
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 49, 26, 40, 14
   CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 95, 26, 40, 14
   CONTROL "&Help", -7866, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 141, 26, 40, 14
}

48 DIALOG 0, 0, 200, 56
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Prompt"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&Text:", 121, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 7, 7, 186, 10
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 7, 18, 186, 12
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 42, 35, 50, 14
   CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 108, 35, 50, 14
}

49 DIALOG 32, 32, 288, 186
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Print"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Printer", 1075, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 8, 4, 272, 84
   CONTROL "&Name:", 1093, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 16, 20, 36, 8
   CONTROL "", 1139, COMBOBOX, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_GROUP | WS_TABSTOP, 52, 18, 152, 152
   CONTROL "&Properties", 1025, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 212, 17, 60, 14
   CONTROL "Status:", 1095, STATIC, SS_LEFT | SS_NOPREFIX | WS_CHILD | WS_VISIBLE | WS_GROUP, 16, 36, 36, 10
   CONTROL "", 1099, STATIC, SS_LEFTNOWORDWRAP | SS_NOPREFIX | WS_CHILD | WS_VISIBLE | WS_GROUP, 52, 36, 224, 10
   CONTROL "Type:", 1094, STATIC, SS_LEFT | SS_NOPREFIX | WS_CHILD | WS_VISIBLE | WS_GROUP, 16, 48, 36, 10
   CONTROL "", 1098, STATIC, SS_LEFTNOWORDWRAP | SS_NOPREFIX | WS_CHILD | WS_VISIBLE | WS_GROUP, 52, 48, 224, 10
   CONTROL "Where:", 1097, STATIC, SS_LEFT | SS_NOPREFIX | WS_CHILD | WS_VISIBLE | WS_GROUP, 16, 60, 36, 10
   CONTROL "", 1101, STATIC, SS_LEFTNOWORDWRAP | SS_NOPREFIX | WS_CHILD | WS_VISIBLE | WS_GROUP, 52, 60, 224, 10
   CONTROL "Comment:", 1096, STATIC, SS_LEFT | SS_NOPREFIX | WS_CHILD | WS_VISIBLE | WS_GROUP, 16, 72, 36, 10
   CONTROL "", 1100, STATIC, SS_LEFTNOWORDWRAP | SS_NOPREFIX | WS_CHILD | WS_VISIBLE | WS_GROUP, 52, 72, 152, 10
   CONTROL "Print to fi&le", 1040, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 212, 70, 64, 12
   CONTROL "Print range", 1072, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 8, 92, 144, 64
   CONTROL "&All", 1056, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 16, 106, 64, 12
   CONTROL "Pa&ges", 1058, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 16, 122, 36, 12
   CONTROL "&Selection", 1057, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 16, 138, 64, 12
   CONTROL "&from:", 1089, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 52, 124, 20, 8
   CONTROL "", 1152, EDIT, ES_LEFT | ES_NUMBER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 74, 122, 26, 12
   CONTROL "&to:", 1090, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 100, 124, 16, 8
   CONTROL "", 1153, EDIT, ES_LEFT | ES_NUMBER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 118, 122, 26, 12
   CONTROL "Copies", 1073, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 160, 92, 120, 64
   CONTROL "Number of &copies:", 1092, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 168, 108, 68, 8
   CONTROL "", 1154, EDIT, ES_LEFT | ES_NUMBER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 240, 106, 32, 12
   CONTROL "", 1086, STATIC, SS_ICON | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 162, 124, 78, 24
   CONTROL "C&ollate", 1041, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 240, 130, 36, 12
   CONTROL "P&rint:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 8, 166, 40, 9
   CONTROL "", 141, COMBOBOX, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_GROUP | WS_TABSTOP, 48, 164, 104, 56
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 180, 164, 48, 14
   CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 232, 164, 48, 14
}

50 DIALOG 0, 0, 124, 47
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Go To Address"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&Hex Offset:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 10, 48, 8
   CONTROL "", 101, EDIT, ES_LEFT | ES_UPPERCASE | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 57, 8, 38, 12
   CONTROL "Go To", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 8, 26, 50, 14
   CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 66, 26, 50, 14
}

52 DIALOG 0, 0, 244, 180
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Associated Files"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&New extension:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 121, 21, 60, 10
   CONTROL "", 141, COMBOBOX, CBS_DROPDOWN | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 121, 31, 60, 70
   CONTROL "D&escription:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 121, 51, 111, 10
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 121, 61, 111, 12
   CONTROL "A&dd", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 121, 85, 50, 14
   CONTROL "&Files associated with TextPad:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 155, 10
   CONTROL "", 135, LISTBOX, LBS_STANDARD | LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 7, 19, 99, 120
   CONTROL "De&lete", 152, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 183, 85, 50, 14
   CONTROL "Explorer or File Manager will automatically start TextPad to edit files with the extensions that you set here.", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 146, 209, 22
}

54 DIALOG 0, 0, 244, 180
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "General"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Reload last &workspace at startup", 161, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 7, 230, 10
   CONTROL "Allow multiple &instances to run", 162, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 19, 230, 10
   CONTROL "Allow multiple &files on the command line", 163, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 31, 230, 10
   CONTROL "W&orking folder follows active document", 164, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 43, 230, 10
   CONTROL "Display startup &logo", 165, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 55, 230, 10
   CONTROL "Send documents as an attachment to &e-mail messages", 166, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 67, 230, 10
   CONTROL "Start with a &new document", 167, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 79, 230, 10
   CONTROL "Minimi&ze to the Taskbar Status Area", 168, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 91, 230, 10
   CONTROL "Put shortcuts to TextPad on:", 113, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 7, 108, 230, 52
   CONTROL "&Program menu", 169, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 14, 120, 108, 10
   CONTROL "Des&ktop", 170, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 14, 132, 108, 10
   CONTROL "Send &To menu", 171, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 14, 144, 108, 10
   CONTROL "&Context menu", 172, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 122, 120, 108, 10
   CONTROL "&Quick Launch toolbar", 173, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 122, 132, 108, 10
   CONTROL "&StartUp menu", 174, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 122, 144, 108, 10
}

55 DIALOG 0, 0, 244, 180
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "View"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Tree1", 117, "SysTreeView32", TVS_SHOWSELALWAYS | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 7, 7, 230, 166
}

56 DIALOG 0, 0, 244, 180
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Editor"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&Constrain the cursor to the text", 161, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 7, 230, 10
   CONTROL "Clear &undo buffer when saving", 163, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 19, 230, 10
   CONTROL "Automatically t&erminate the last line of the file", 164, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 31, 230, 10
   CONTROL "Enable &drag and drop editing", 169, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 43, 230, 10
   CONTROL "&Keystroke compatibility:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 76, 100, 10
   CONTROL "", 141, COMBOBOX, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 7, 87, 90, 90
   CONTROL "S&how keyboard shortcuts on menus", 165, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 7, 106, 230, 12
   CONTROL "Use &Microsoft's conventions for mouse click selection", 166, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 7, 118, 230, 12
   CONTROL "Use &POSIX regular expression syntax", 167, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 7, 130, 230, 12
}

57 DIALOG 0, 0, 244, 180
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Spelling"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&Dictionary:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 6, 230, 10
   CONTROL "", 141, COMBOBOX, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 7, 17, 100, 91
   CONTROL "&New...", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 130, 17, 50, 14
   CONTROL "&Edit...", 152, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 187, 17, 50, 14
   CONTROL "Tree1", 117, "SysTreeView32", TVS_SHOWSELALWAYS | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 7, 38, 229, 102
   CONTROL "&Faster search", -1, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 152, 36, 20
   CONTROL "", 297, "msctls_trackbar32", TBS_HORZ | TBS_AUTOTICKS | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 44, 153, 156, 20
   CONTROL "More accurate", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 201, 152, 36, 20
}

59 DIALOG 0, 0, 300, 34
STYLE DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION
CAPTION ""
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "File &format:", 121, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 1, 48, 10
   CONTROL "", 141, COMBOBOX, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_GROUP | WS_TABSTOP, 54, 0, 155, 50
   CONTROL "En&coding:", 122, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 19, 40, 10
   CONTROL "", 142, COMBOBOX, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_GROUP | WS_TABSTOP, 54, 18, 155, 64
   CONTROL "&Read-only", 161, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 222, 0, 70, 12
   CONTROL "Se&lection only", 162, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 222, 0, 70, 12
}

62 DIALOG 0, 0, 244, 180
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Tabulation"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&Default tab spacing:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 9, 71, 10
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 78, 7, 15, 12
   CONTROL "&Indent size:", -1, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 107, 9, 61, 10
   CONTROL "", 102, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 173, 7, 15, 12
   CONTROL "Convert &new tabs to spaces", 161, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 24, 230, 10
   CONTROL "Convert &existing tabs to spaces when saving files", 162, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 35, 230, 10
   CONTROL "&Tab stops:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 7, 51, 181, 75
   CONTROL "", 141, COMBOBOX, CBS_SIMPLE | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 15, 64, 80, 56
   CONTROL "&Set", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 115, 64, 60, 14
   CONTROL "&Clear", 152, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 115, 84, 60, 14
   CONTROL "C&lear All", 153, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 115, 104, 60, 14
   CONTROL "Tab stops represent the number of spaces needed to fill out to the specified column.  Hence they work best with fixed width fonts, such as Courier.", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 133, 195, 25
}

64 DIALOG 0, 0, 244, 139
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Document"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Full name:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 40, 10
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 48, 7, 189, 12
   CONTROL "Statistics:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 7, 21, 231, 58
   CONTROL "Total:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 86, 29, 72, 8
   CONTROL "Selected:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 158, 29, 72, 8
   CONTROL "Characters:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 14, 40, 72, 10
   CONTROL "", 121, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 86, 40, 72, 10
   CONTROL "", 124, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 158, 40, 72, 10
   CONTROL "Words:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 14, 52, 72, 10
   CONTROL "", 122, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 86, 52, 72, 10
   CONTROL "", 125, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 158, 52, 72, 10
   CONTROL "Lines:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 14, 64, 72, 10
   CONTROL "", 123, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 86, 64, 72, 10
   CONTROL "", 126, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 158, 64, 72, 10
   CONTROL "Code set:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 86, 73, 10
   CONTROL "", 127, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 80, 86, 157, 10
   CONTROL "File type:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 98, 73, 10
   CONTROL "", 128, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 80, 98, 157, 10
   CONTROL "File size:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 110, 73, 10
   CONTROL "", 129, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 80, 110, 157, 10
   CONTROL "Last saved at:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 122, 73, 10
   CONTROL "", 130, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 80, 122, 157, 10
}

65 DIALOG 0, 0, 244, 180
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "File Name Filters"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&File name filters:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 230, 10
   CONTROL "", 135, LISTBOX, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 7, 17, 230, 44
   CONTROL "D&escription:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 68, 230, 10
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 7, 78, 230, 12
   CONTROL "&Wild cards:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 97, 231, 10
   CONTROL "", 102, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 7, 107, 230, 12
   CONTROL "&New", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 129, 50, 14
   CONTROL "De&lete", 152, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 63, 129, 50, 14
   CONTROL "Move &Up", 153, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 131, 129, 50, 14
   CONTROL "Move D&own", 154, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 187, 129, 50, 14
   CONTROL "The filters that you set here will be used on the File Open and Save As dialog boxes to list files of a given type.", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 151, 230, 20
}

66 DIALOG 0, 0, 244, 180
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "File"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Number of recent &files on File menu:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 168, 10
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | ES_NUMBER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 176, 6, 26, 12
   CONTROL "Number of recent &workspaces on File menu:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 24, 168, 10
   CONTROL "", 102, EDIT, ES_LEFT | ES_AUTOHSCROLL | ES_NUMBER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 176, 23, 26, 12
   CONTROL "Default file &extension:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 41, 168, 10
   CONTROL "", 103, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 176, 40, 26, 12
   CONTROL "O&verwrite original files directly, when saving changes", 161, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 64, 230, 10
   CONTROL "&Keep files locked while editing them", 162, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 76, 230, 10
   CONTROL "Open &locked files read-only", 163, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 88, 230, 10
   CONTROL "When files are modified by another process:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 104, 230, 58
   CONTROL "Pr&ompt", 271, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 14, 118, 65, 10
   CONTROL "Auto-&Reload", 272, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 87, 118, 65, 10
   CONTROL "Ig&nore", 273, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 160, 118, 65, 10
   CONTROL "Ignore differences in &modification times less than 2 seconds", 164, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 14, 134, 221, 10
   CONTROL "&Check for file size changes", 165, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 14, 146, 221, 10
}

68 DIALOG 0, 0, 212, 164
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Fill Selected Block"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 84, 6, 50, 12
   CONTROL "With &characters:", 271, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 6, 7, 78, 10
   CONTROL "With &numbers from:", 272, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 6, 25, 78, 10
   CONTROL "", 102, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 84, 24, 50, 12
   CONTROL "&By:", -1, STATIC, SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 136, 25, 20, 10
   CONTROL "", 103, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 156, 24, 50, 12
   CONTROL "Format:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 6, 42, 200, 30
   CONTROL "Align &left", 273, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 16, 54, 60, 10
   CONTROL "Align &right", 274, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 76, 54, 60, 10
   CONTROL "Leading &zeros", 275, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 136, 54, 58, 10
   CONTROL "Fill mode:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 7, 79, 200, 30
   CONTROL "&Insert", 276, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 16, 91, 60, 10
   CONTROL "R&eplace", 277, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 76, 91, 60, 10
   CONTROL "In insert mode, a block the same width as the selection is inserted.  In replace mode, the selection is replaced.", -1, STATIC, SS_LEFT | SS_SUNKEN | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 116, 200, 20
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 47, 143, 50, 14
   CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 113, 143, 50, 14
}

70 DIALOG 0, 0, 270, 167
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Register TextPad"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "To register TextPad, paste the license details you received into the box below (using Ctrl+V), and then click OK.", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 256, 23
   CONTROL "", 101, EDIT, ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 7, 30, 256, 109
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 44, 146, 50, 14
   CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 110, 146, 50, 14
   CONTROL "&Help", -7866, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 176, 146, 50, 14
}

72 DIALOG 0, 0, 132, 146
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Sort Selected Column"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Sort order:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 6, 6, 120, 34
   CONTROL "&Ascending", 271, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 20, 16, 90, 10
   CONTROL "&Descending", 272, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 20, 26, 90, 10
   CONTROL "Comparison:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 6, 45, 120, 45
   CONTROL "Case &sensitive", 273, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 20, 55, 90, 10
   CONTROL "Case &insensitive", 274, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 20, 65, 90, 10
   CONTROL "&Numeric", 275, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 20, 75, 90, 10
   CONTROL "In &character code order", 161, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 20, 96, 106, 12
   CONTROL "D&elete duplicate lines", 162, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 20, 108, 106, 12
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 11, 126, 50, 14
   CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 71, 126, 50, 14
}

73 DIALOG 0, 0, 253, 177
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Sort Selected Lines"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "First Key", 113, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 6, 6, 81, 126
   CONTROL "&From:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 19, 16, 28, 10
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | ES_NUMBER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 19, 26, 24, 12
   CONTROL "&Length:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 50, 16, 28, 10
   CONTROL "", 102, EDIT, ES_LEFT | ES_AUTOHSCROLL | ES_NUMBER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 50, 26, 24, 12
   CONTROL "Sort order:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 11, 42, 71, 34
   CONTROL "&Ascending", 271, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 16, 52, 65, 10
   CONTROL "&Descending", 272, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 16, 62, 65, 10
   CONTROL "Comparison:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 11, 81, 71, 45
   CONTROL "Case &sensitive", 273, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 16, 91, 65, 10
   CONTROL "Case &insensitive", 274, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 16, 101, 65, 10
   CONTROL "&Numeric", 275, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 16, 111, 65, 10
   CONTROL "Second Key", 114, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 86, 6, 81, 126
   CONTROL "&From:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 99, 16, 28, 10
   CONTROL "", 103, EDIT, ES_LEFT | ES_AUTOHSCROLL | ES_NUMBER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 99, 26, 24, 12
   CONTROL "&Length:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 130, 16, 28, 10
   CONTROL "", 104, EDIT, ES_LEFT | ES_AUTOHSCROLL | ES_NUMBER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 130, 26, 24, 12
   CONTROL "Sort order:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 91, 42, 71, 34
   CONTROL "&Ascending", 276, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 96, 52, 65, 10
   CONTROL "&Descending", 277, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 96, 62, 65, 10
   CONTROL "Comparison:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 91, 81, 71, 45
   CONTROL "Case &sensitive", 278, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 96, 91, 65, 10
   CONTROL "Case &insensitive", 279, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 96, 101, 65, 10
   CONTROL "&Numeric", 280, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 96, 111, 65, 10
   CONTROL "Third Key", 115, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 166, 6, 81, 126
   CONTROL "&From:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 179, 16, 28, 10
   CONTROL "", 105, EDIT, ES_LEFT | ES_AUTOHSCROLL | ES_NUMBER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 179, 26, 24, 12
   CONTROL "&Length:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 210, 16, 28, 10
   CONTROL "", 106, EDIT, ES_LEFT | ES_AUTOHSCROLL | ES_NUMBER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 210, 26, 24, 12
   CONTROL "Sort order:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 171, 42, 71, 34
   CONTROL "&Ascending", 281, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 176, 52, 65, 10
   CONTROL "&Descending", 282, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 176, 62, 65, 10
   CONTROL "Comparison:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 171, 81, 71, 45
   CONTROL "Case &sensitive", 283, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 176, 91, 65, 10
   CONTROL "Case &insensitive", 284, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 176, 101, 65, 10
   CONTROL "&Numeric", 285, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 176, 111, 65, 10
   CONTROL "In &character code order", 161, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 6, 138, 127, 12
   CONTROL "D&elete duplicate lines", 162, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 143, 138, 100, 12
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 68, 156, 50, 14
   CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 134, 156, 50, 14
}

74 DIALOG 40, 30, 280, 158
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Tip of the Day"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Close", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 222, 135, 50, 14
   CONTROL "&Next tip", 1302, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 162, 135, 50, 14
   CONTROL "&Show tips on startup", 1301, BUTTON, BS_AUTOCHECKBOX | BS_TOP | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 137, 146, 12
   CONTROL "", 1201, STATIC, SS_ICON | WS_CHILD | WS_VISIBLE, 15, 16, 20, 20
   CONTROL "", 121, STATIC, SS_GRAYFRAME | WS_CHILD | WS_VISIBLE, 7, 7, 266, 122
   CONTROL "Tip", 1303, STATIC, SS_LEFT | SS_NOPREFIX | WS_CHILD | WS_VISIBLE | WS_GROUP, 39, 40, 227, 82
}

76 DIALOG 0, 0, 244, 180
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Printing"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Parameters:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 7, 5, 171, 61
   CONTROL "H&eader:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 14, 19, 47, 8
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 66, 18, 104, 12
   CONTROL "&Footer:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 14, 36, 47, 8
   CONTROL "", 102, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 66, 35, 104, 12
   CONTROL "F&ile Time", 271, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP, 14, 51, 75, 12
   CONTROL "Pri&nt Time", 272, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 94, 51, 60, 12
   CONTROL "Margins:", 113, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 70, 171, 48
   CONTROL "&Left:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 14, 83, 34, 8
   CONTROL "", 103, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 50, 82, 24, 12
   CONTROL "&Right:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 86, 83, 34, 8
   CONTROL "", 104, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 121, 82, 24, 12
   CONTROL "&Top:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 14, 100, 34, 8
   CONTROL "", 105, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 50, 99, 24, 12
   CONTROL "&Bottom:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 86, 100, 34, 8
   CONTROL "", 106, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 121, 99, 24, 12
   CONTROL "Options:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 7, 122, 171, 51
   CONTROL "&Word wrap long lines", 161, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 14, 133, 90, 12
   CONTROL "Line n&umbers", 162, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 104, 133, 70, 12
   CONTROL "In &color", 163, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 14, 145, 90, 12
   CONTROL "&Double space", 164, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 104, 145, 70, 12
   CONTROL "&Restart with default printer", 165, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 14, 157, 110, 12
   CONTROL "&Printer...", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 187, 159, 50, 14
}

77 DIALOG 0, 0, 250, 55
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "TextPad"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Some of your documents have been modified.  Save all of them, none of them, choose which to save, or cancel this command?", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 34, 7, 209, 20
   CONTROL "Save &All", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 34, 50, 14
   CONTROL "Save &None", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 70, 34, 50, 14
   CONTROL "&Choose", 152, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 130, 34, 50, 14
   CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 190, 34, 50, 14
   CONTROL 2002, -1, STATIC, SS_ICON | WS_CHILD | WS_VISIBLE, 7, 7, 18, 20
}

78 DIALOG 0, 0, 244, 180
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Backup"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Automatically &save every", 161, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 10, 100, 10
   CONTROL "", 102, EDIT, ES_LEFT | ES_AUTOHSCROLL | ES_NUMBER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 107, 8, 20, 14
   CONTROL "minutes", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 134, 10, 46, 8
   CONTROL "&Backup files before saving changes", 162, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 33, 210, 10
   CONTROL "Backup FILE.EXT as:", 113, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 7, 49, 210, 62
   CONTROL "&FILE.BAK", 271, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 17, 60, 79, 10
   CONTROL "F&ILE.BAK.EXT", 272, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 17, 71, 79, 10
   CONTROL "FI&LE.EXT.BAK", 273, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 17, 82, 79, 10
   CONTROL "FIL&E.EXT in folder:", 274, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 17, 93, 79, 10
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 97, 92, 98, 12
   CONTROL "...", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 198, 91, 14, 14
   CONTROL "Use these settings to control if and how a backup copy of the original file is made when saving changes.", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 117, 210, 17
}

79 DIALOG 0, 0, 244, 180
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Font"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&Font:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 40, 9
   CONTROL "", 141, COMBOBOX, CBS_SIMPLE | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | CBS_NOINTEGRALHEIGHT | CBS_DISABLENOSCROLL | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 7, 16, 111, 70
   CONTROL "Font st&yle:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 123, 7, 72, 9
   CONTROL "", 142, COMBOBOX, CBS_SIMPLE | CBS_NOINTEGRALHEIGHT | CBS_DISABLENOSCROLL | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 123, 16, 72, 72
   CONTROL "S&ize:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 200, 7, 37, 9
   CONTROL "", 143, COMBOBOX, CBS_SIMPLE | CBS_SORT | CBS_NOINTEGRALHEIGHT | CBS_DISABLENOSCROLL | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 200, 16, 37, 72
   CONTROL "Scope:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 89, 111, 63
   CONTROL "&Screen", 271, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 13, 99, 102, 10
   CONTROL "&Printer", 272, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 13, 111, 102, 10
   CONTROL "&Both", 273, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 13, 123, 102, 10
   CONTROL "Use for &DOS files", 161, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 13, 137, 102, 10
   CONTROL "Sc&ript:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 123, 89, 30, 9
   CONTROL "", 144, COMBOBOX, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 123, 99, 114, 69
   CONTROL "Sample", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 123, 115, 114, 37
   CONTROL "AaMmZz1234\nÀàÉéÎîÕõÜü", 121, STATIC, SS_CENTER | SS_NOPREFIX | WS_CHILD | WS_VISIBLE, 131, 124, 100, 26
   CONTROL "Static", 122, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 157, 230, 20
}

80 DIALOG 0, 0, 244, 180
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Colors"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&Item:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 50, 10
   CONTROL "", 135, LISTBOX, LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 7, 17, 111, 152
   CONTROL "Sample", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 125, 13, 112, 71
   CONTROL "", 121, STATIC, SS_SIMPLE | WS_CHILD | WS_VISIBLE, 130, 24, 102, 32
   CONTROL "", 122, STATIC, SS_SIMPLE | WS_CHILD | WS_VISIBLE, 130, 57, 102, 21
   CONTROL "", 152, BUTTON, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 146, 93, 70, 20
   CONTROL "", 153, BUTTON, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 146, 120, 70, 20
   CONTROL "Set &Defaults", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 146, 156, 70, 14
}

81 DIALOG 0, 0, 244, 180
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Macros"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Macros a&vailable:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 68, 10
   CONTROL "", 135, LISTBOX, LBS_STANDARD | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 18, 68, 131
   CONTROL "A&dd >>", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 82, 28, 80, 14
   CONTROL "<< &Remove", 152, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 82, 46, 80, 14
   CONTROL "De&lete", 157, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 82, 64, 80, 14
   CONTROL "Move &Up", 155, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 82, 90, 80, 14
   CONTROL "Move Do&wn", 156, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 82, 108, 80, 14
   CONTROL "&Properties...", 153, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 82, 134, 80, 14
   CONTROL "Macros on &menu:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 169, 7, 68, 10
   CONTROL "", 136, LISTBOX, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 169, 18, 68, 131
}

82 DIALOG 0, 0, 208, 171
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Macro Properties"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&File name:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 8, 50, 10
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_CHILD | WS_VISIBLE, 57, 7, 144, 12
   CONTROL "&Display name:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 27, 50, 10
   CONTROL "", 102, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 57, 26, 144, 12
   CONTROL "&Author:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 46, 50, 10
   CONTROL "", 103, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 57, 45, 144, 12
   CONTROL "Descri&ption:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 64, 50, 10
   CONTROL "", 104, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 7, 74, 194, 12
   CONTROL "Default play mode:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 39, 93, 130, 48
   CONTROL "Play &once", 271, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 46, 105, 100, 10
   CONTROL "Repeat through &selection", 272, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 46, 115, 100, 10
   CONTROL "Repeat to &end of file", 273, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 46, 125, 100, 10
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 46, 150, 50, 14
   CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 112, 150, 50, 14
}

83 DIALOG 0, 0, 144, 109
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Playback Macro"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&Macro:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 35, 10
   CONTROL "", 141, COMBOBOX, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_GROUP | WS_TABSTOP, 7, 17, 100, 70
   CONTROL "Specified &number of times:", 271, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 7, 40, 100, 10
   CONTROL "Repeat through &selection", 272, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 7, 55, 100, 10
   CONTROL "Repeat to &end of file", 273, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 7, 70, 100, 10
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | ES_NUMBER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 107, 39, 30, 12
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 15, 88, 50, 14
   CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 79, 88, 50, 14
}

84 DIALOG 0, 0, 208, 186
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Save Macro"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Macro Folder:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 7, 7, 50, 10
   CONTROL "Static", 121, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 57, 7, 144, 10
   CONTROL "&File name:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 7, 25, 50, 10
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 57, 24, 144, 12
   CONTROL "&Display name:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 7, 44, 50, 10
   CONTROL "", 102, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 57, 43, 144, 12
   CONTROL "&Author:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 7, 63, 50, 10
   CONTROL "", 103, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 57, 62, 144, 12
   CONTROL "Descri&ption:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 7, 81, 50, 10
   CONTROL "", 104, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 7, 91, 194, 12
   CONTROL "Default play mode:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 39, 110, 130, 48
   CONTROL "Play &once", 271, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 46, 122, 100, 10
   CONTROL "Repeat through &selection", 272, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 46, 132, 100, 10
   CONTROL "Repeat to &end of file", 273, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 46, 142, 100, 10
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 15, 165, 50, 14
   CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 79, 165, 50, 14
   CONTROL "&Browse...", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 143, 165, 50, 14
}

85 DIALOG 0, 0, 187, 73
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Choose Folder"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 9, 52, 50, 14
   CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 68, 52, 50, 14
   CONTROL "&Browse", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 127, 52, 50, 14
   CONTROL "Static", 121, STATIC, SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 173, 20
   CONTROL "&Folder:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 34, 40, 10
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 47, 33, 133, 12
}

86 DIALOGEX 0, 0, 244, 180
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Document Classes"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&User defined classes:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 100, 8
   CONTROL "List1", 135, "SysListView32", LVS_REPORT | LVS_OWNERDRAWFIXED | LVS_NOCOLUMNHEADER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 7, 16, 107, 130 , 0x00000200
   CONTROL "Note that this list of classes can only be modified when no documents are open.\n\nAfter adding a new class, Click Apply, then select that class to add to its list of members.", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 127, 16, 107, 90
}

87 DIALOGEX 0, 0, 244, 180
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Preferences"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&Files in class", 122, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 60, 8
   CONTROL "", 123, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 15, 60, 8
   CONTROL "?", 121, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 15, 60, 8
   CONTROL "List1", 135, "SysListView32", LVS_REPORT | LVS_OWNERDRAWFIXED | LVS_NOCOLUMNHEADER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 7, 24, 60, 117 , 0x00000200
   CONTROL "Tree1", 117, "SysTreeView32", TVS_SHOWSELALWAYS | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 74, 7, 163, 134
   CONTROL "&Word break at column number:", 161, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 74, 149, 135, 10
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | ES_NUMBER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 211, 148, 26, 12
   CONTROL "Apply these &settings to all document classes", 162, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 74, 163, 163, 10
}

88 DIALOG 0, 0, 244, 180
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Syntax"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Enable &syntax highlighting", 161, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 7, 230, 10
   CONTROL "Syntax &definition file:", 121, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 21, 173, 8
   CONTROL "", 141, COMBOBOX, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_OEMCONVERT | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_GROUP | WS_TABSTOP, 7, 31, 173, 71
   CONTROL "&Open", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 187, 30, 50, 14
   CONTROL "When selecting and stepping over , the default set of characters in a word are letters, numbers and those used in keywords in the syntax definition file.  If you need to include any others, type them in the box below.", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 57, 230, 32
   CONTROL "Other &characters in words:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 100, 92, 8
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 102, 97, 135, 14
}

89 DIALOG 0, 0, 244, 180
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Folders"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "List1", 135, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 7, 7, 230, 113
   CONTROL "", 121, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 132, 212, 10
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 7, 142, 212, 12
   CONTROL "...", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 223, 141, 14, 14
}

90 DIALOG 0, 0, 170, 115
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "TextPad"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL 2001, -1, STATIC, SS_ICON | WS_CHILD | WS_VISIBLE, 7, 7, 18, 20
   CONTROL "Do you want to save this macro now?\nIf not, you can save it later with the Save command on the Macro menu.", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 34, 7, 129, 26
   CONTROL "In future:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 40, 156, 47
   CONTROL "Prompt with this &message", 271, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 14, 51, 147, 10
   CONTROL "Prompt to &save the macro", 272, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 14, 61, 147, 10
   CONTROL "Do not &prompt", 273, BUTTON, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 14, 71, 147, 10
   CONTROL "&Yes", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 27, 94, 50, 14
   CONTROL "&No", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 93, 94, 50, 14
}

91 DIALOG 0, 0, 213, 118
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Spelling"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Change &to:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 31, 56, 8
   CONTROL "", 102, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 7, 40, 96, 12
   CONTROL "", 135, LISTBOX, LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 7, 53, 96, 39
   CONTROL "&Ignore", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 110, 40, 46, 14
   CONTROL "I&gnore All", 152, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 160, 40, 46, 14
   CONTROL "&Change", 153, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 110, 59, 46, 14
   CONTROL "Auto-co&rrect", 154, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 160, 59, 46, 14
   CONTROL "&Add", 155, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 110, 78, 46, 14
   CONTROL "&Suggest", 156, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 160, 78, 46, 14
   CONTROL "&Options...", 157, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 97, 46, 14
   CONTROL "&Undo Last", 158, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 57, 97, 46, 14
   CONTROL "Close", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 110, 97, 46, 14
   CONTROL "&Help", -7866, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 160, 97, 46, 14
   CONTROL "", 121, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 6, 199, 8
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 7, 15, 199, 12
}

92 DIALOG 0, 0, 200, 68
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Create Dictionary"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&Name:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 9, 45, 8
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 52, 7, 141, 14
   CONTROL "&Language:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 29, 45, 8
   CONTROL "", 141, COMBOBOX, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 52, 28, 141, 58
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 42, 47, 50, 14
   CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 108, 47, 50, 14
}

93 DIALOG 15, 27, 275, 252
STYLE DS_MODALFRAME | DS_NOIDLEMSG | WS_POPUP | WS_VISIBLE | WS_CAPTION
CAPTION "Edit Dictionary"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Na&me:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 42, 8
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 49, 6, 219, 12
   CONTROL "Words:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 7, 25, 260, 97
   CONTROL "", 141, COMBOBOX, CBS_SIMPLE | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 13, 39, 118, 56
   CONTROL "A&ction:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 13, 95, 118, 8
   CONTROL "", 142, COMBOBOX, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 13, 103, 248, 80
   CONTROL "Replacemen&t:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 137, 31, 124, 8
   CONTROL "", 102, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 137, 39, 125, 12
   CONTROL "&Add Word", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 140, 57, 57, 14
   CONTROL "&Delete Word", 152, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 140, 74, 57, 14
   CONTROL "&Import...", 153, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 204, 57, 57, 14
   CONTROL "&Export...", 154, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 204, 74, 57, 14
   CONTROL "Files:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 7, 128, 260, 96
   CONTROL "&Language:", -1, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 11, 139, 36, 8
   CONTROL "", 121, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 51, 139, 144, 8
   CONTROL "", 135, LISTBOX, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 14, 153, 177, 64
   CONTROL "Add &File...", 155, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 202, 139, 59, 14
   CONTROL "&New File...", 156, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 202, 155, 59, 14
   CONTROL "&Remove File", 157, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 202, 171, 59, 14
   CONTROL "Move &Up", 158, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 202, 187, 59, 14
   CONTROL "Move D&own", 159, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 202, 203, 59, 14
   CONTROL "Close", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 79, 231, 50, 14
   CONTROL "&Help", -7866, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 145, 231, 50, 14
}

94 DIALOG 0, 0, 300, 67
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Create Dictionary Word List File"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&File Name:", -1, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 9, 45, 8
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 56, 7, 178, 12
   CONTROL "&Browse...", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 243, 6, 50, 14
   CONTROL "&Language:", -1, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 29, 45, 8
   CONTROL "", 141, COMBOBOX, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 56, 27, 178, 56
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 56, 46, 50, 14
   CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 120, 46, 50, 14
   CONTROL "&Help", -7866, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 184, 46, 50, 14
}

95 DIALOG 0, 0, 244, 180
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Language"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&User interface language:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 140, 10
   CONTROL "", 135, LISTBOX, LBS_STANDARD | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 17, 100, 100
   CONTROL "Choose the language for the user interface.  This will affect menus, dialog boxes and messages.", -1, STATIC, SS_LEFT | SS_NOPREFIX | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 134, 210, 25
}

96 DIALOG 0, 0, 244, 180
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Keyboard"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&Categories:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 50, 10
   CONTROL "", 135, LISTBOX, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 7, 17, 60, 64
   CONTROL "C&ommands:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 74, 7, 76, 10
   CONTROL "", 136, LISTBOX, LBS_STANDARD | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 74, 17, 92, 64
   CONTROL "Press new s&hortcut key:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 88, 110, 10
   CONTROL "", 291, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 7, 98, 110, 12
   CONTROL "Currently assigned to:", 121, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 117, 110, 10
   CONTROL "", 122, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 127, 110, 10
   CONTROL "A&ssign", 151, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 173, 13, 64, 14
   CONTROL "&Remove", 152, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 173, 31, 64, 14
   CONTROL "R&eset All", 153, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 173, 49, 64, 14
   CONTROL "C&urrent keys:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 126, 88, 111, 10
   CONTROL "", 137, LISTBOX, LBS_STANDARD | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 127, 98, 110, 39
   CONTROL "Description:", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 7, 142, 230, 30
   CONTROL "", 123, STATIC, SS_LEFT | SS_NOPREFIX | WS_CHILD | WS_VISIBLE | WS_GROUP, 13, 151, 215, 18
   CONTROL "&List", 154, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 173, 67, 64, 14
}

99 DIALOG 0, 0, 200, 203
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Clip Library Entry"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&Name of clipping:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 186, 8
   CONTROL "", 101, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 7, 16, 186, 14
   CONTROL "&Replace selection", 161, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 37, 186, 10
   CONTROL "Text &before cursor or selection:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 52, 186, 8
   CONTROL "", 102, EDIT, ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 7, 62, 186, 48
   CONTROL "Text &after cursor or selection:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 117, 186, 8
   CONTROL "", 103, EDIT, ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 7, 127, 186, 48
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 35, 182, 50, 14
   CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 101, 182, 50, 14
}

20509 DIALOG 0, 0, 251, 181
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Commands"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Sans Serif"
{
   CONTROL "Buttons", -22443, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 74, 7, 170, 100
   CONTROL "", -22442, LISTBOX, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 7, 16, 59, 91
   CONTROL "Categories:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 8, 7, 36, 8
   CONTROL "Select a category, then click a button to see its description. Drag the button to any toolbar", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 113, 237, 18
   CONTROL "Description", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 7, 133, 237, 34
   CONTROL "", -22441, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 13, 144, 225, 19
}

20511 DIALOG 0, 0, 174, 62
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "New Toolbar"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Sans Serif"
{
   CONTROL "&Toolbar name:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 46, 8
   CONTROL "", -22440, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 7, 17, 98, 13
   CONTROL "&OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 117, 7, 50, 14
   CONTROL "&Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 117, 24, 50, 14
   CONTROL "&Help", -7866, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 117, 41, 50, 14
}

20513 DIALOG 0, 0, 251, 181
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Toolbars"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Sans Serif"
{
   CONTROL "Toolbars:", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 30, 8
   CONTROL "", -22442, LISTBOX, LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP, 7, 17, 100, 124
   CONTROL "Toolbar name:", -22439, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_GROUP, 7, 146, 46, 8
   CONTROL "", -22434, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_BORDER | WS_TABSTOP, 7, 156, 100, 13
   CONTROL "&Show Tooltips", -22435, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 117, 17, 71, 10
   CONTROL "C&ool Look", -22432, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 117, 29, 71, 10
   CONTROL "&Large Buttons", -22433, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 117, 41, 71, 10
   CONTROL "&New...", -22438, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 189, 16, 50, 14
   CONTROL "&Reset", -22436, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 189, 33, 50, 14
}

23150 DIALOG 0, 0, 251, 14
STYLE WS_CHILD | WS_CAPTION | WS_THICKFRAME
CAPTION ""
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Sans Serif"
{
   CONTROL "&Print", -19859, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 2, 35, 12
   CONTROL "&Next", -19858, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 46, 2, 35, 12
   CONTROL "&Previous", -19857, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 87, 2, 35, 12
   CONTROL "&Close", -19861, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 128, 2, 35, 12
   CONTROL "", -19860, COMBOBOX, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 171, 1, 49, 65
}

30721 DIALOG 9, 26, 183, 70
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "New"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&New ", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 6, 5, 123, 8
   CONTROL "", 100, LISTBOX, LBS_NOTIFY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 6, 15, 125, 49
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 137, 6, 40, 14
   CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 137, 23, 40, 14
   CONTROL "&Help", -7866, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 137, 43, 40, 14
}

30722 DIALOG 6, 18, 0, 0
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
CAPTION ""
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Printing", -1, STATIC, SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 0, 9, 133, 8
   CONTROL "", 201, STATIC, SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 0, 19, 133, 8
   CONTROL "on the", -1, STATIC, SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 0, 29, 133, 8
   CONTROL "", 202, STATIC, SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 0, 39, 133, 8
   CONTROL "", 203, STATIC, SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 0, 49, 133, 8
   CONTROL "", 204, STATIC, SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 0, 59, 133, 8
   CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 46, 74, 40, 14
}

30723 DIALOG 0, 0, 330, 16
STYLE WS_CHILD | WS_CAPTION
CAPTION ""
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "&Print...", -7420, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 2, 2, 44, 12
   CONTROL "Pre&v Page", -7421, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 48, 2, 44, 12
   CONTROL "&Next Page", -7422, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 94, 2, 44, 12
   CONTROL "", -7423, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 140, 2, 44, 12
   CONTROL "Zoom &In", -7419, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 186, 2, 44, 12
   CONTROL "Zoom &Out", -7418, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 232, 2, 44, 12
   CONTROL "&Close", -7424, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 278, 2, 44, 12
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
2, 	"TextPad"
3, 	"\nDocument\nText\nSource(*.txt)\n.txt"
4, 	"\nBinary.\n\nExecutables(*.exe)\n.exe"
6, 	"Selector"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
180, 	"Enter &License Code..."
181, 	"THIS PRODUCT IS NOT FREE"
182, 	"Copyright © 1992-2003 Helios Software Solutions"
183, 	"License code: %s"
184, 	"Licensed to: %s"
185, 	"Maximum users: %d"
186, 	"Maximum users: Unlimited"
187, 	"32-bit Edition"
189, 	"About %s"
190, 	"This program requires Windows 95, NT 4 or later versions"
191, 	"These license details are not correct.  Please check your input, or contact sales@textpad.com for a valid license."
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
192, 	"Thank you for registering TextPad.\nPlease save a copy of your license details, in case your hard drive fails, or need to reinstall the software."
194, 	"Helios Software Solutions"
195, 	"This beta release will timeout in %d days"
196, 	"This beta release will timeout on %s"
197, 	"This beta release has timed out.\nPlease get the latest release from http://www.textpad.com/"
198, 	"TextPad Workspace (*.tws)|*.tws||"
199, 	"Break"
200, 	"%s: %I64u KB Free"
201, 	"Wrong version for '%s'.\nActual = %d.%d.%d.%d, Required = %d.%d.%d.%d\nThis resource will not be used."
202, 	"TextPad Workspace"
203, 	"&File Manager"
204, 	"User Tool"
205, 	"New"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
210, 	"Not enough memory for that operation"
212, 	"Out of memory.  Undo stack emptied.  Close some files and/or applications."
213, 	"Invalid executable image in file\n%s"
214, 	"CreateProcess error %d on command:\n%s"
215, 	"This file is already loaded"
216, 	"[ -~][ -~][ -~][ -~]+"
217, 	"Searching for: %s\n"
218, 	"Installed OLE is Version %d.%d\nThis requires Version %d.%d"
219, 	"OLE initialize failure 0x%x"
220, 	"Cannot save with the name of a file that is open in another window"
221, 	"Save all modified files?"
222, 	"Macro file names may not include a directory path.\nThe path can be changed  on the Macros page of the Preferences dialog box."
223, 	"Macro file names must have the extension .TPM"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
224, 	"Error accessing '%s'\n%s."
225, 	"All or part of the path is invalid"
226, 	"%s\nis an empty file"
227, 	"File type:"
228, 	"Location:"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
240, 	"Delete"
241, 	"Touch"
242, 	"Copy"
243, 	"Rename/Move"
244, 	"OK to replace existing file\n'%s'"
245, 	"OK to create\n'%s'"
246, 	"Cannot open \"%s\""
247, 	"Invalid operation for path\n'%s'"
248, 	"Cannot copy/rename multiple files to\n'%s'"
249, 	"This file already has the name\n'%s'"
250, 	"Another application has updated file\n%s\nReload it?"
251, 	"No (, {, [, <, or >, ], }, ) to match"
252, 	"Cannot find '%c' to match '%c'"
253, 	"About TextPad#- TextPad"
254, 	"Printer Font"
255, 	"Insert Files"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
256, 	"Open File"
257, 	"Save As"
258, 	"Open File(s)"
259, 	"Searching for:\n%s"
260, 	"Comparing:\n%s\n%s"
263, 	"Deleted %ld lines"
264, 	"Line %d is %u bytes long\nSplit into %u byte lines?"
265, 	"File: %s, %ld bytes, %d lines, %s, %s"
266, 	"%ld characters, %ld words, %ld lines"
267, 	"TextPad needs COMCTL32.DLL 4.70 or later.\nYou can obtain an update from:\nhttp://support.microsoft.com/support/kb/articles/Q186/1/76.ASP"
271, 	"File: %s, %ld bytes"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
272, 	"Search passed the beginning of file"
273, 	"Search passed the end of file"
274, 	"Split %d lines"
275, 	"Drag the cursor to move the selection."
276, 	"Drag the cursor to copy the selection."
277, 	"Operation interrupted - it  would make line %d longer than %d characters"
278, 	"Select Files"
279, 	"Text Files (*.txt,*.ini)|*.txt;*.ini|C/C++ (*.cpp,*.c,*.h,*.hpp,*.cxx,*.hxx,*.inl)|*.cpp;*.c;*.h;*.hpp;*.cxx;*.hxx;*.inl|HTML (*.htm*,*.stm*)|*.html;*.htm;*.stml;*.stm|Java (*.java)|*.java|Clip Library (*.tcl)|*.tcl|All Files (*.*)|*.*||"
280, 	"Invalid format for number."
281, 	"Margins (inches)"
282, 	"Margins (millimeters)"
283, 	"Replace all occurrences in all documents?"
284, 	"Operation cancelled!\nIt would make file longer than %d lines"
286, 	"Undo all edits since the last save checkpoint?"
287, 	"Redo all edits to the next save checkpoint?"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
288, 	"Undo is complete"
289, 	"Redo is complete"
290, 	"Invalid regular expression"
291, 	"Regular expression too complex"
292, 	"Unmatched '( or {'"
293, 	"Unmatched ') or }'"
294, 	"Cannot find literal string:\n'%s'"
295, 	"This document is read only!"
296, 	"Replaced %ld occurrence(s)"
297, 	"Cannot find regular expression:\n'%s'"
298, 	"*.txt *.ini|*.cpp *.c *.cxx *.h *.hxx||"
299, 	"Found %ld occurrence(s) in %d file(s)"
300, 	"Search Results"
301, 	"Command Results"
302, 	"&+ %d More..."
303, 	"Cannot jump to item under the cursor"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
304, 	"At end of list"
305, 	"At beginning of list"
306, 	"Cannot compare a file with itself"
307, 	"Command cancelled!"
308, 	"Compare: (<)%s (%d bytes)\n   with: (>)%s (%d bytes)\n\n"
309, 	"The files are identical\n"
310, 	"*.exe *.dll"
311, 	"File has more than %d lines.\nIt will be truncated."
312, 	"Programs|*.exe;*.pif;*.com;*.bat|All Files (*.*)|*.*||"
313, 	"Select a File"
314, 	"Binary (*.exe,*.obj,*.lib,*.dll)|*.exe;*.obj;*.lib;*.dll|All Files (*.*)|*.*||"
315, 	"Tool completed with exit code %ld"
316, 	"Tool completed successfully"
317, 	"Tool cancelled"
318, 	"This action will terminate the active tool.\nDo you really want to exit?"
319, 	"Macros (*.tpm)|*.tpm|All Files (*.*)|*.*||"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
320, 	"The required field is empty"
321, 	"There is no default printer defined"
322, 	"Cannot get device context for printer:\n%s, %s, %s"
323, 	"WARNING: file changed while reading\n%s"
324, 	"A common dialog box returned error 0x%.4x\nPlease notify support@textpad.com.\nTry restarting first TextPad, then Windows."
325, 	"Invalid hexadecimal digit\n(Only 0-9 and A-F allowed)"
326, 	"Can only redirect output from console applications.\nContinue anyway?"
327, 	"Commands must not contain spaces, nor be empty"
328, 	"WARNING: Cannot backup a .BAK file"
329, 	"Failed to create backup file for\n%s"
330, 	"Register number conflict"
331, 	"Change to the size of the recently used files and workspaces lists will be effected on the next startup."
332, 	"Preferences"
333, 	"Error %ld opening pipe to PLUMB.EXE"
334, 	"Open %s"
335, 	"Joined %d lines into %d"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
336, 	"Split %d lines into %d"
337, 	"No lines needed splitting"
338, 	"Can't replace the start or end of line with nothing"
340, 	"txt"
341, 	"Reloaded %s"
342, 	"%s: WARNING - cannot open\n"
343, 	"%s: WARNING - non-textual file\n"
344, 	"Failed to get a device context for this printer"
345, 	"WARNING: This may be a binary data file.\nIt contains %ld null characters which\nwill be replaced with spaces if you edit it.\nDo you want to continue?"
346, 	"Properties for %s"
347, 	"&Lines"
348, 	"&Characters"
349, 	"Stop &Recording"
350, 	"R&esume"
351, 	"Stop &Playing"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
352, 	"The file extension cannot include spaces, dots, \\, /, ? or *."
353, 	"The file extension cannot include spaces, dots, \\, /, \"*?\" or \"**\"."
354, 	"Cancel"
355, 	"Close"
356, 	"The clipboard is in use by another process"
357, 	"&Join Lines"
358, 	"Split &Wrapped Lines"
359, 	"Reformatted %d lines into %d"
360, 	"Auto|Text|Binary|"
361, 	"0|1|2|"
362, 	"No change|PC|UNIX|Mac|"
363, 	"0|3|4|5|"
364, 	"Stay on &Top"
365, 	"Warning: %s\nOnly read %ld of %ld characters.\nEnd of file marker (Ctrl+Z) before physical end."
366, 	"Default|ANSI|DOS|"
367, 	"Default|ANSI|DOS|Unicode|Unicode (big endian)|UTF-8|"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
368, 	"File"
369, 	"Assembler File"
370, 	"C Source File"
371, 	"C++ Source File"
372, 	"Header Source File"
373, 	"HTML Document"
374, 	"Setup Information"
375, 	"Configuration Settings"
376, 	"Java Source File"
377, 	"Pascal Source File"
378, 	"Perl Source File"
379, 	"Cold Fusion Templates"
380, 	"Clip Library"
381, 	"Syntax Definition File"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
384, 	"&Fill"
385, 	"Leading &zeros"
386, 	"Read-only attribute cleared for %s"
387, 	"Invalid number"
388, 	"Con&vert to DOS"
389, 	"Con&vert to ANSI"
390, 	"%s contains an invalid path"
391, 	"Found %ld occurrence(s)"
392, 	"Character number %d is invalid"
393, 	"WARNING: \"%s\" contains characters that do not exist in code page %s. They will be converted to the system default character, if you click OK."
397, 	"Invalid workspace archive"
398, 	"Unexpected problem loading workspace archive.\nCannot restore full workspace."
399, 	"Unexpected problem storing workspace archive"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
400, 	"Scratch Macro"
401, 	"%s is not a valid macro file."
402, 	"Note that if you change the macro folder, all the current macros will be unloaded."
403, 	"Choose the Folder for storing macros."
404, 	"Invalid regular expression: '\\n*' or '\\n+'"
405, 	"Cannot search files for a regular expression including '\\n'"
406, 	"Choose the folder for saving backups:"
407, 	"Cannot insert new lines in blocks"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
418, 	"Choose the folder to search in:"
419, 	"Erase the current unsaved macro?"
420, 	"%d bytes selected"
421, 	"%d lines selected"
422, 	"%d lines, %d columns selected"
423, 	"Remove all words from this user dictionary?"
424, 	"This word is already in the dictionary."
425, 	"Added %ld words"
426, 	"Word \"%s\" has more than %d characters"
427, 	"WARNING: out of memory in the list of words.\nNot all words are shown."
428, 	"WARNING: the conversion is not reversible for characters that are unique\nto the current code set, and the command cannot be undone.\nDo you want to proceed?"
429, 	"%s already exists.\nDo you want to replace it?"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
432, 	"%s has been modified"
433, 	"You will need to restart TextPad to effect this change."
434, 	"Cannot cut, copy, or drag and drop text containing null (code = 0) characters."
435, 	"Reading: %s"
436, 	"Writing: %s"
437, 	"View in &Web Browser"
438, 	"Did you know ..."
439, 	"Trouble reading the tips file"
442, 	"File|Edit|Search|View|Tools|Macros|Configure|Window|Help|Cursor|Selection|Clip Library|Characters|All"
445, 	"Invalid keyboard bindings file"
446, 	"Changing the emulation will lose all custom key assignments.\nAre you sure you want to do this?"
447, 	"Are you sure you want to reset key assignments to their defaults?\nThis action cannot be reversed."
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
448, 	"Prefix key"
449, 	"OK to delete: %s"
450, 	"Invalid clip book data in line %d\nof %s"
451, 	"Invalid data in line %d\nof %s"
452, 	"Class names cannot contain unprintable characters, backslashes, nor start with spaces"
453, 	"Unknown"
454, 	"WARNING: %s is a member of classes %s and %s"
455, 	"WARNING: to include all files with this extension, use *%s"
456, 	"This document class already exists. Please choose another name."
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
464, 	"Automatic"
465, 	"Normal"
466, 	"Selected"
472, 	"Save changes to %s?"
473, 	"Clipboard History"
474, 	"Type title for new clip book:"
475, 	"Type new name:"
476, 	"Are you sure you want to delete the entire document?\nThis command cannot be undone."
477, 	"Auto-saving ..."
478, 	"Do you want to revert to the last saved\n%s?"
479, 	"Do you want to save changes to the workspace?"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
480, 	"Backups"
481, 	"Custom shortcuts"
482, 	"Clip Library"
483, 	"Macros"
484, 	"Startup"
485, 	"Syntax"
486, 	"User dictionaries"
487, 	"WWW root folder"
488, 	"WWW IP address"
492, 	"All pages in range"
493, 	"Odd pages"
494, 	"Even pages"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
496, 	"Text"
497, 	"Selected text"
498, 	"Selected text (no focus)"
499, 	"Bookmarks"
500, 	"Left margin"
501, 	"Page breaks"
502, 	"Keywords 1"
503, 	"Keywords 2"
504, 	"Keywords 3"
505, 	"Keywords 4"
506, 	"Keywords 5"
507, 	"Keywords 6"
509, 	"Preprocessor keywords"
510, 	"Comments"
511, 	"Comments 2"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
512, 	"Numbers"
513, 	"Characters"
514, 	"Strings"
515, 	"Visible spaces"
516, 	"URL"
517, 	"Brackets"
518, 	"Operators"
519, 	"Foreground"
520, 	"Background"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
528, 	"Light green"
529, 	"Sky blue"
530, 	"Cream"
531, 	"Light grey"
532, 	"Custom"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
544, 	"Default"
545, 	"Binary"
546, 	"Commands"
547, 	"Standard"
548, 	"File"
549, 	"Edit"
550, 	"Search"
551, 	"Macros"
552, 	"Tools"
553, 	"Window"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
560, 	"Tool"
561, 	"DOS Command"
562, 	"Java Applet"
563, 	"Java SDK Commands"
564, 	"Compile Java"
565, 	"Run Java Application"
566, 	"Run Java Applet"
567, 	"Clos&e DOS window on exit"
568, 	"Page setup for document class %s"
569, 	"Page setup for all document classes"
570, 	"Document Class Wizard"
571, 	"Reconvert"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
672, 	"Block"
673, 	"23:59"
674, 	"0000000"
675, 	"0000000"
676, 	"Read"
677, 	"'"
678, 	"Rec"
679, 	"Sync"
680, 	"Open an existing file\nOpen"
681, 	"Save the active file\nSave"
682, 	"Print the active file using current defaults\nPrint"
683, 	"Copy the selection to the Clipboard\nCopy"
684, 	"Cut the selection to the Clipboard\nCut"
685, 	"Insert Clipboard contents\nPaste"
686, 	"Undo the last action\nUndo"
687, 	"Redo the previously undone action\nRedo"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
688, 	"Record a keystroke macro\nRecorder On/Off"
689, 	"Pause the keystroke macro recorder\nPause Recorder"
690, 	"Playback a macro\nPlayback"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
800, 	"Added %ld words to the dictionary."
801, 	"The spelling check is complete.\n%ld words were changed."
802, 	"(No suggestions)"
803, 	"Not in dictionary:"
804, 	"Repeated word:"
805, 	"Consider changing:"
806, 	"Incorrect capitalization:"
807, 	"Unexpected error %d\nCannot continue"
808, 	"Cannot open more than 32 dictionaries"
809, 	"The word replacement action is invalid"
810, 	"This dictionary cannot be modified"
811, 	"This file format is not supported"
812, 	"The file does not appear to be a valid dictionary"
813, 	"The dictionary cannot be found"
814, 	"A dictionary of this name already exists"
815, 	"Error reading from a dictionary"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
816, 	"Error writing to a dictionary"
817, 	"Error opening a dictionary"
818, 	"The files for the %s dictionary have not been installed.\nYou can download them from http://www.textpad.com/"
819, 	"Any"
820, 	"Auto change using case of replacement"
821, 	"Auto change using case of checked word"
822, 	"Conditionally change using case of replacement"
823, 	"Conditionally change using case of checked word"
824, 	"Ignore (treat as correctly spelled)"
825, 	"Exclude (treat as misspelled)"
826, 	"Dictionaries (*.tlx,*.txt)|*.tlx;*.txt|All Files (*.*)|*.*||"
827, 	"Dictionaries (*.clx,*.tlx)|*.clx;*.tlx|All Files (*.*)|*.*||"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
832, 	"Western"
833, 	"Arabic"
834, 	"Baltic"
835, 	"Chinese (traditional)"
836, 	"Default"
837, 	"OEM/DOS"
838, 	"Cyrillic"
839, 	"Chinese (simplified)"
840, 	"Greek"
841, 	"Korean (Hangul)"
842, 	"Korean (Johab)"
843, 	"Hebrew"
844, 	"Mac"
845, 	"Russian"
846, 	"Japanese"
847, 	"Symbol"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
848, 	"Thai"
849, 	"Turkish"
850, 	"Vietnamese"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
1000, 	"Document class options:"
1001, 	"Maintain indentation"
1002, 	"Automatically indent blocks"
1003, 	"Include trailing spaces when selecting words"
1004, 	"Strip trailing spaces from lines when saving"
1005, 	"View in web browser"
1006, 	"Word wrap long lines"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
1009, 	"Word wrapped text:"
1010, 	"Save with no breaks in lines"
1011, 	"Save with hard breaks"
1012, 	"Check spelling of:"
1013, 	"Comments"
1014, 	"Strings"
1015, 	"Words with underscores"
1017, 	"Default code set:"
1018, 	"ANSI"
1019, 	"DOS"
1020, 	"Create new files as:"
1021, 	"PC"
1022, 	"UNIX"
1023, 	"Mac"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
1024, 	"Spell checker options:"
1025, 	"Ignore capitalized words (e.g. England)"
1026, 	"Ignore words in capitals only (e.g. ASAP)"
1027, 	"Ignore words with numbers (e.g. Win98)"
1028, 	"Ignore words with mixed case (e.g. TextPad)"
1029, 	"Ignore single letters (e.g. b)"
1030, 	"Case sensitive"
1031, 	"Report doubled words (e.g. the the)"
1032, 	"Auto correct"
1033, 	"Remember which words to correct automatically"
1034, 	"Suggestions for unrecognised words:"
1035, 	"Phonetic"
1036, 	"Typographical"
1037, 	"Split words"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
1040, 	"View options:"
1041, 	"Full path names on document selector and tabs"
1042, 	"Popup names on the document selector"
1043, 	"Popup tips"
1044, 	"Vertical scroll bar"
1045, 	"Horizontal scroll bar"
1046, 	"Visible alerts"
1047, 	"Audible alerts"
1048, 	"Line numbers"
1049, 	"Block cursor"
1050, 	"Clock on status bar"
1051, 	"Transparent dialog boxes (on Windows 2000/XP)"
1052, 	"Stay on top of other windows"
1053, 	"Minimize when last document is closed"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
1056, 	"Visible white space:"
1057, 	"Spaces"
1058, 	"Tabs"
1059, 	"Paragraphs"
1060, 	"Tabbed Document Selector:"
1061, 	"At top of frame"
1062, 	"Stacked"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
4080, 	"Keep TextPad on top of other windows"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
20526, 	"You must select a shortcut before clicking Remove."
20527, 	"You must select a macro before clicking Create."
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
20528, 	"Reset All will set all shortcuts back to their defaults.  Any shortcuts you have created will be forgotten.  Are you sure you want to do this?"
20529, 	"(Unassigned)"
20530, 	"That key combination is reserved and may not be reassigned."
20531, 	"New (Insert)"
20532, 	"Delete (Delete)"
20533, 	"Move Up (Alt+Up Arrow)"
20534, 	"Move Down (Alt+Down Arrow)"
20535, 	"Press the Ctrl key to prevent docking."
20536, 	"&Reset"
20537, 	"&Delete"
20538, 	"Customize"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
20617, 	"Enter"
20618, 	"Error "
20619, 	"Menu bar"
20621, 	" [Design]"
20622, 	"TabStop"
20623, 	" Visible"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
20624, 	"noclose"
20625, 	"Select Directory"
20626, 	"Select File"
20627, 	".%if"
20628, 	"&Undo\tCtrl+Z"
20629, 	"Cu&t\tCtrl+X"
20630, 	"&Copy\tCtrl+C"
20631, 	"&Paste\tCtrl+V"
20632, 	"&Delete\tDelete"
20633, 	"Select &All"
20634, 	"Select Directory"
20635, 	"T"
20636, 	"C"
20637, 	"CE"
20638, 	"<-"
20639, 	"%"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
20640, 	"7"
20641, 	"8"
20642, 	"9"
20643, 	"/"
20644, 	"4"
20645, 	"5"
20646, 	"6"
20647, 	"*"
20648, 	"1"
20649, 	"2"
20650, 	"3"
20651, 	"-"
20652, 	"0"
20653, 	"+"
20654, 	"0"
20655, 	"Hide docked window"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
20656, 	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
20657, 	"Expand docked window"
20658, 	"Contract docked window"
20659, 	"About "
20660, 	"&Windows..."
20661, 	"SECSplashWnd"
20662, 	"SECSplashWndParent"
20663, 	"Did you know..."
20664, 	"&Workspaces..."
20665, 	"Workspace Manager"
20666, 	"Invalid workspace name."
20667, 	"Workspace '%s' already exists. Please enter a unique workspace name."
20668, 	"Invalid workspace name."
20669, 	"Workspace '%s' already exists. Please enter a unique workspace name."
20670, 	"Save new workspace '%s'?\n"
20671, 	"Workspaces"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
20672, 	""
20673, 	"You must select an item for this operation"
20674, 	"ToolBar%d"
20675, 	"SECCryptoFile cannot be opened in both Output Feedback (OFB) mode and CFile::modeReadWrite."
20676, 	"Overview Window"
20677, 	"Alt + "
20678, 	"(No description available)"
20679, 	"No Preview..."
20680, 	"Select Program"
20681, 	"Programs|*.exe;*.pif;*.com;*.bat|All files (*.*)|*.*||"
20682, 	"Select Initial Directory"
20683, 	"(new tool)"
20684, 	"The menu text cannot be blank"
20685, 	"(none)"
20686, 	"Open Workspace"
20687, 	"Workspaces"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
20688, 	"All Files"
20689, 	"Save Workspace"
20690, 	"Invalid workspace. Operation has been cancelled."
20695, 	"Arial"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
23075, 	"All files (*.*)\n*.*"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
23100, 	"&Other..."
23101, 	"Rotate90: Error, unsupported format."
23102, 	"&Window"
23103, 	"XML Files (.xml)"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
32768, 	"Copy, rename, delete or touch files\nManage Files"
32770, 	"Print the active document using current defaults\nPrint"
32772, 	"Revert the current document to the last saved version\nRevert"
32773, 	"Make first character of each selected sentence upper case & the rest lower case"
32774, 	"Insert the file name"
32775, 	"Rename or move the current document's file\nRename"
32776, 	"Insert statistical information about this document"
32780, 	"Open a workspace\nOpen Workspace"
32781, 	"Save the workspace\nSave Workspace"
32782, 	"Close the workspace\nClose Workspace"
32783, 	"Save the workspace with a new name\nSave Workspace As"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
32784, 	"Open a file based on the selected text"
32785, 	"Close all documents"
32786, 	"Save all changed documents\nSave All"
32787, 	"Display this file's statistics on status bar"
32788, 	"Transpose the words either side of the cursor"
32789, 	"Transpose characters or lines either side of the cursor"
32790, 	"Reduce indentation of selected lines by the indent size setting\nReduce Indent"
32791, 	"Increase indentation of selected lines by the indent size setting\nIncrease Indent"
32792, 	"Cut selection and append to the clipboard"
32793, 	"Copy selection and append to the clipboard"
32794, 	"Insert contents of one or more files at the cursor position"
32795, 	"Invert the case of the selection, or character after the cursor"
32796, 	"Change selection or character after the cursor to upper case"
32797, 	"Change selection or character after the cursor to lower case"
32798, 	"Make first character of each selected word upper case & the rest lower case"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
32800, 	"Cut the current line and put it on the Clipboard"
32801, 	"Cut the current line and append it to the Clipboard"
32802, 	"Mark the active document as unmodified"
32803, 	"Delete the current line"
32804, 	"Delete the current word"
32805, 	"Start IME reconversion"
32806, 	"Search for text in the active document\nFind"
32807, 	"Find next occurrence of search string"
32808, 	"Find previous occurrence of search string"
32809, 	"Replace occurrences of search string\nReplace"
32810, 	"Replace next occurrence of search string"
32811, 	"Go to specified line, column, page, byte offset or bookmark"
32812, 	"Find matching bracket"
32813, 	"Search for a text pattern in multiple files\nFind in Files"
32814, 	"Toggle read-only state"
32815, 	"Configure your preferences"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
32816, 	"Customize the toolbars"
32817, 	"Show or hide the tabbed document selector"
32818, 	"Toggle full screen view\nFull Screen"
32819, 	"Toggle word-wrap mode\nWord Wrap"
32820, 	"Toggle block/line selection mode for all views"
32821, 	"Show or hide horizontal scroll bar"
32822, 	"Show or hide vertical scroll bar"
32823, 	"Show or hide full paths on the document selector and tabs"
32826, 	"Activate the next document\nNext Document"
32827, 	"Activate the previous document\nPrevious Document"
32828, 	"Activate the document selector"
32829, 	"Close the document selector"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
32848, 	"Find differences between two files\nCompare Files"
32849, 	"Run Explorer or File Manager"
32850, 	"Start another application"
32851, 	"Cancel the tool running in the Command Results window"
32852, 	"Sort lines in the active document\nSort"
32853, 	"Convert this document between DOS and ANSI code sets"
32854, 	"Start user-defined tool 1\nTool 1"
32855, 	"Start user-defined tool 2\nTool 2"
32856, 	"Start user-defined tool 3\nTool 3"
32857, 	"Start user-defined tool 4\nTool 4"
32858, 	"Start user-defined tool 5\nTool 5"
32859, 	"Start user-defined tool 6\nTool 6"
32860, 	"Start user-defined tool 7\nTool 7"
32861, 	"Start user-defined tool 8\nTool 8"
32862, 	"Start user-defined tool 9\nTool 9"
32863, 	"Start user-defined tool 10\nTool 10"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
32864, 	"Start user-defined tool 11\nTool 11"
32865, 	"Start user-defined tool 12\nTool 12"
32866, 	"Start user-defined tool 13\nTool 13"
32867, 	"Start user-defined tool 14\nTool 14"
32868, 	"Start user-defined tool 15\nTool 15"
32869, 	"Start user-defined tool 16\nTool 16"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
32940, 	"Show or hide visible spaces\nVisible »·¶"
32941, 	"Set or clear a bookmark on the current line\nToggle Bookmark"
32942, 	"Go to the next bookmark\nNext Bookmark"
32943, 	"Go to previous bookmark\nPrevious Bookmark"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
32944, 	"Clear all bookmarks\nClear All Bookmarks"
32945, 	"Show or hide line numbers\nLine Numbers"
32946, 	"Configure properties for this document"
32947, 	"Invert all bookmarks\nInvert All Bookmarks"
32949, 	"Display the results of the last Find in Files command"
32950, 	"Display the results of the last Tool command"
32953, 	"Jump to next item in search or command results window\nJump Next"
32954, 	"Jump to previous item in search or command results window\nJump Previous"
32955, 	"Insert HTML from the clipboard"
32956, 	"Insert the clipboard contents in block mode"
32957, 	"Insert the clipboard contents in line mode"
32958, 	"Cut the word under the cursor and put it on the Clipboard"
32959, 	"Cut the word under the cursor and append it to the Clipboard"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
32960, 	"Center selected lines in the view"
32961, 	"Insert a new line before the current line"
32962, 	"Insert a new line after the current line"
32963, 	"Open the referenced file or URL"
32964, 	"Split lines where they wrap at the right margin"
32965, 	"Insert a page break at start of current line"
32966, 	"Adjust line lengths to the right margin\nReformat"
32967, 	"Append next line to current line, or join all selected lines"
32971, 	"Align selected lines to the left margin"
32972, 	"Align selected lines to the right margin"
32973, 	"Justify text in selected paragraphs to both margins"
32974, 	"Insert the current time"
32975, 	"Insert the date in short format"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
32976, 	"Insert the date in long format"
32977, 	"Delete selected text"
32979, 	"Delete all lines with bookmarks on them"
32980, 	"Cut to clipboard all lines with bookmarks on them"
32981, 	"Copy to clipboard all lines with bookmarks on them"
32982, 	"Fill selected block with specified character(s)"
32983, 	"Copy the current line to the clipboard"
32984, 	"Copy the current line and append it to to the clipboard"
32985, 	"Copy the current word to the clipboard"
32986, 	"Copy the current word and append it to to the clipboard"
32987, 	"Copy the active document's file name to the clipboard"
32988, 	"Copy the file names of all open documents to the clipboard"
32989, 	"Copy selected text to the clipboard as a HTML page"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
33104, 	"Record or stop recording a keystroke macro"
33105, 	"Pause/Resume the keystroke macro recorder"
33106, 	"Playback the scratch macro"
33107, 	"Playback a selected macro multiple times"
33108, 	"Save the scratch macro"
33109, 	"Play back this macro"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
33200, 	"View the document in the default web browser\nView in Web Browser"
33201, 	"Open all files in the Search Results window"
33202, 	"Synchronize scrolling in all views"
33203, 	"Check the spelling in this document\nCheck Spelling"
33204, 	"Enable or disable the ability to undo edits"
33205, 	"Create a new document class"
33206, 	"Enter your license details to register TextPad"
33207, 	"Get support information for TextPad"
33208, 	"Find out how to purchase TextPad"
33209, 	"Get answers to frequently asked questions"
33210, 	"Display a tip of the day"
33211, 	"Activate the Clip Library"
33212, 	"Open http://www.textpad.com/"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
33216, 	"Save this clip book"
33217, 	"Rename this clip book"
33218, 	"Delete this clip book"
33219, 	"Create a new clip book"
33220, 	"Reload all clip books"
33221, 	"Close the Clip Library"
33222, 	"Insert this entry in the active document"
33223, 	"Copy this entry to the clipboard"
33224, 	"Rename the entry"
33225, 	"Delete the entry from the clip book"
33226, 	"Paste a new entry from the clipboard"
33227, 	"Sort the entries"
33228, 	"Edit this entry"
33229, 	"Edit this clip book"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
33232, 	"Open this workspace"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
33300, 	"Add a new program to the Tools menu"
33301, 	"Add a new DOS command to the Tools menu"
33302, 	"Add a new Help command to the Tools menu"
33303, 	"Add a new separator to the tools menu"
33304, 	"Add support for the Java SDK to the Tools menu"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
43004, 	"Show all windows in a dialog"
43005, 	"Load a previously saved workspace"
43006, 	"Save the open windows and their position on the desktop"
43007, 	"Create a new workspace"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
43008, 	"Open an existing workspace"
43009, 	"Save the active workspace"
43010, 	"Save your desktop to the named workspace"
43011, 	"Close the active workspace"
43012, 	"Close the active workspace"
43013, 	"Saves the currently open windows to the selected workspace"
43014, 	"Delete the selected workspace"
43015, 	"Activate selected window"
43016, 	"Activate selected window"
43017, 	"Activate selected window"
43018, 	"Activate selected window"
43019, 	"Activate selected window"
43020, 	"Activate selected window"
43021, 	"Activate selected window"
43022, 	"Activate selected window"
43023, 	"Activate selected window"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
43024, 	"Activate selected window"
43025, 	"Activate selected window"
43026, 	"Activate selected window"
43027, 	"Activate selected window"
43028, 	"Activate selected window"
43029, 	"Activate selected window"
43030, 	"Activate selected window"
43031, 	"Open the selected workspace"
43032, 	"Open the selected workspace"
43033, 	"Open the selected workspace"
43034, 	"Open the selected workspace"
43035, 	"Open the selected workspace"
43036, 	"Open the selected workspace"
43037, 	"Open the selected workspace"
43038, 	"Open the selected workspace"
43039, 	"Open the Workspace Manager"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
43040, 	"Allow Docking"
43041, 	"Hide"
43042, 	"Float In Main Window"
43044, 	"Activates user-defined tool 1\nUser-Tool 1"
43045, 	"Activates user-defined tool 2\nUser-Tool 2"
43046, 	"Activates user-defined tool 3\nUser-Tool 3"
43047, 	"Activates user-defined tool 4\nUser-Tool 4"
43048, 	"Activates user-defined tool 5\nUser-Tool 5"
43049, 	"Activates user-defined tool 6\nUser-Tool 6"
43050, 	"Activates user-defined tool 7\nUser-Tool 7"
43051, 	"Activates user-defined tool 8\nUser-Tool 8"
43052, 	"Activates user-defined tool 9\nUser-Tool 9"
43054, 	"Large Icon\nLarge Icon"
43055, 	"Small Icon\nSmall Icon"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
45660, 	"Arranges the windows as overlapping tiles"
45661, 	"Arranges the windows as vertical, non-overlapping tiles"
45662, 	"Arranges the windows as horizontal, non-overlapping tiles"
45663, 	"Arrange minimized icons"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
53000, 	"Create a new item\nNew"
53001, 	"Delete the selected items\nDelete (Del Key)"
53002, 	"Move the item one up\nMove Up (Alt+Up Arrow)"
53003, 	"Move the item one down\nMove Down (Alt+Down Arrow)"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
57344, 	"TextPad"
57345, 	"For Help, press F1"
57346, 	"Select an object on which to get Help"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
57600, 	"Create a new document\nNew Document"
57601, 	"Open an existing document\nOpen"
57602, 	"Close the active document\nClose"
57603, 	"Save the active document\nSave"
57604, 	"Save the active document with a new name\nSave As"
57605, 	"Change the printed page setup for the active document class"
57607, 	"Print the active document\nPrint"
57609, 	"Display full pages as they will be printed\nPrint Preview"
57612, 	"Send the active document through electronic mail\nSend Mail"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
57616, 	"Open this document"
57617, 	"Open this document"
57618, 	"Open this document"
57619, 	"Open this document"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
57632, 	"Erase the next character or the selection"
57633, 	"Erase everything"
57634, 	"Copy the selection to the Clipboard\nCopy"
57635, 	"Cut the selection to the Clipboard\nCut"
57637, 	"Insert Clipboard contents\nPaste"
57640, 	"Repeat the last action"
57642, 	"Select the entire document"
57643, 	"Undo the last action\nUndo"
57644, 	"Redo the previously undone action\nRedo"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
57649, 	"Arrange icons at the bottom of the window\nArrange icons"
57650, 	"Arrange windows so they overlap\nCascade"
57651, 	"Arrange windows as tiles down the screen\nTile Horizontally"
57652, 	"Arrange windows as tiles across the screen\nTile Vertically"
57653, 	"Split the active window into panes\nSplit"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
57664, 	"Display program information, version number and copyright"
57665, 	"Quit the application; prompts to save files"
57667, 	"List TextPad help topics"
57669, 	"Display help for clicked on buttons, menus and windows\nHelp"
57670, 	"Display help for current task or command"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
57680, 	"Switch to the next window pane"
57681, 	"Switch back to the previous window pane"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
59137, 	"Caps"
59139, 	"Scrl"
59140, 	"Ovr"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
59393, 	"Show or hide the status bar"
59396, 	"Show or hide the Clip Library\nClip Library"
59397, 	"Show or hide the Document Selector\nDocument Selector"
59398, 	"Show or hide this toolbar"
59399, 	"Show or hide this toolbar"
59400, 	"Show or hide this toolbar"
59401, 	"Show or hide this toolbar"
59402, 	"Show or hide this toolbar"
59403, 	"Show or hide this toolbar"
59404, 	"Show or hide this toolbar"
59405, 	"Show or hide this toolbar"
59406, 	"Show or hide this toolbar"
59407, 	"Show or hide this toolbar"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
61184, 	"Change the window size"
61185, 	"Change the window position"
61186, 	"Reduce the window to an icon"
61187, 	"Enlarge the window to full size"
61188, 	"Switch to the next document window"
61189, 	"Switch to the previous document window"
61190, 	"Close the active window and prompts to save the documents"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
61202, 	"Restore the window to normal size"
61203, 	"Activate Task List"
61215, 	"Activate this window"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
61440, 	"Open"
61441, 	"Save As"
61442, 	"All Files (*.*)"
61443, 	"Untitled"
61446, 	"an unnamed file"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
61457, 	"&Hide"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
61472, 	"No error message is available."
61473, 	"An unsupported operation was attempted."
61474, 	"A required resource was unavailable."
61475, 	"Out of memory."
61476, 	"An unknown error has occurred."
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
61504, 	"on %1"
61505, 	"&One Page"
61506, 	"&Two Page"
61507, 	"Page %u"
61508, 	"Page %u\nPages %u-%u\n"
61509, 	"prn"
61510, 	"Output.prn"
61511, 	"Printer Files (*.prn)|*.prn|All Files (*.*)|*.*||"
61512, 	"Print to File"
61513, 	"to %1"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
61588, 	"Linked %s"
61589, 	"Unknown Type"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
61696, 	"Invalid filename."
61697, 	"Failed to open document."
61698, 	"Failed to save document."
61699, 	"Save changes to %1?"
61700, 	"Failed to create empty document."
61701, 	"The file is too large to open."
61702, 	"Could not start print job."
61703, 	"Failed to launch help."
61704, 	"Internal application error."
61705, 	"Command failed."
61706, 	"Insufficient memory to perform operation."
61707, 	"System registry entries have been removed and the INI file (if any) was deleted."
61708, 	"Not all of the system registry entries (or INI file) were removed."
61709, 	"This program requires the file %s, which was not found on this system."
61710, 	"This program is linked to the missing export %s in the file %s. This machine may have an incompatible version of %s."
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
61712, 	"Please enter an integer."
61713, 	"Please enter a number."
61714, 	"Please enter an integer between %1 and %2."
61715, 	"Please enter a number between %1 and %2."
61716, 	"Please enter no more than %1 characters."
61717, 	"Please select a button."
61718, 	"Please enter an integer between 0 and 255."
61719, 	"Please enter a positive integer."
61720, 	"Please enter a date and/or time."
61721, 	"Please enter a currency."
61722, 	"Please enter a GUID."
61723, 	"Please enter a time."
61724, 	"Please enter a date."
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
61728, 	"Unexpected file format."
61729, 	"%1\nCannot find this file.\nPlease verify that the correct path and file name are given."
61730, 	"Destination disk drive is full."
61731, 	"Unable to read from %1, it is opened by someone else."
61732, 	"Unable to write to %1, it is read-only or opened by someone else."
61733, 	"An unexpected error occurred while reading %1."
61734, 	"An unexpected error occurred while writing %1."
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
61744, 	"%1: %2\nContinue running script?"
61745, 	"Dispatch exception: %1"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
61828, 	"The file is not supported by a Document Object server."
61829, 	"%1\nUnable to register document.\nThe document may already be open."
61836, 	"Unable to read write-only property."
61837, 	"Unable to write read-only property."
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
61840, 	"Unable to load mail system support."
61841, 	"Mail system DLL is invalid."
61842, 	"Send Mail failed to send message."
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
61856, 	"No error occurred."
61857, 	"An unknown error occurred while accessing %1."
61858, 	"%1 was not found."
61859, 	"%1 contains an invalid path."
61860, 	"%1 could not be opened because there are too many open files."
61861, 	"Access to %1 was denied."
61862, 	"An invalid file handle was associated with %1."
61863, 	"%1 could not be removed because it is the current directory."
61864, 	"%1 could not be created because the directory is full."
61865, 	"Seek failed on %1"
61866, 	"A hardware I/O error was reported while accessing %1."
61867, 	"A sharing violation occurred while accessing %1."
61868, 	"A locking violation occurred while accessing %1."
61869, 	"Disk full while accessing %1."
61870, 	"An attempt was made to access %1 past its end."
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
61872, 	"No error occurred."
61873, 	"An unknown error occurred while accessing %1."
61874, 	"An attempt was made to write to the reading %1."
61875, 	"An attempt was made to access %1 past its end."
61876, 	"An attempt was made to read from the writing %1."
61877, 	"%1 has a bad format."
61878, 	"%1 contained an unexpected object."
61879, 	"%1 contains an incorrect schema."
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
61888, 	"pixels"
}

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
62177, 	"Uncheck"
62178, 	"Check"
62179, 	"Mixed"
}

2 ACCELERATORS
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
    VK_0, 32845, NOINVERT, CONTROL, VIRTKEY
    VK_0, 33211, NOINVERT, ALT, VIRTKEY
    VK_1, 32854, NOINVERT, CONTROL, VIRTKEY
    VK_1, 32828, NOINVERT, ALT, VIRTKEY
    VK_2, 32855, NOINVERT, CONTROL, VIRTKEY
    VK_3, 32856, NOINVERT, CONTROL, VIRTKEY
    VK_4, 32857, NOINVERT, CONTROL, VIRTKEY
    VK_5, 32858, NOINVERT, CONTROL, VIRTKEY
    VK_6, 32859, NOINVERT, CONTROL, VIRTKEY
    VK_7, 32860, NOINVERT, CONTROL, VIRTKEY
    VK_8, 32861, NOINVERT, CONTROL, VIRTKEY
    VK_9, 32862, NOINVERT, CONTROL, VIRTKEY
    VK_A, 57642, NOINVERT, CONTROL, VIRTKEY
    VK_B, 603, NOINVERT, CONTROL, VIRTKEY
    VK_B, 604, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_C, 57634, NOINVERT, CONTROL, VIRTKEY
    VK_C, 32793, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_D, 601, NOINVERT, CONTROL, VIRTKEY
    VK_D, 602, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_E, 32960, NOINVERT, CONTROL, VIRTKEY
    VK_E, 32972, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_F, 32807, NOINVERT, CONTROL, VIRTKEY
    VK_F, 32808, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_G, 32811, NOINVERT, CONTROL, VIRTKEY
    VK_G, 32784, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_H, 714, NOINVERT, CONTROL, VIRTKEY
    VK_I, 32791, NOINVERT, CONTROL, VIRTKEY
    VK_I, 32790, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_J, 32967, NOINVERT, CONTROL, VIRTKEY
    VK_J, 32964, NOINVERT, ALT, CONTROL, VIRTKEY
    VK_J, 32966, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_K, 32795, NOINVERT, CONTROL, VIRTKEY
    VK_K, 32773, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_L, 32797, NOINVERT, CONTROL, VIRTKEY
    VK_L, 32965, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_M, 32812, NOINVERT, CONTROL, VIRTKEY
    VK_M, 32838, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_N, 57600, NOINVERT, CONTROL, VIRTKEY
    VK_O, 57601, NOINVERT, CONTROL, VIRTKEY
    VK_O, 600, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_P, 57607, NOINVERT, CONTROL, VIRTKEY
    VK_P, 57609, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_R, 33106, NOINVERT, CONTROL, VIRTKEY
    VK_R, 33104, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_S, 57603, NOINVERT, CONTROL, VIRTKEY
    VK_S, 32786, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_T, 32789, NOINVERT, CONTROL, VIRTKEY
    VK_T, 32788, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_U, 32796, NOINVERT, CONTROL, VIRTKEY
    VK_U, 32798, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_V, 57637, NOINVERT, CONTROL, VIRTKEY
    VK_V, 32794, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_APPS, 32835, NOINVERT, VIRTKEY
    VK_APPS, 32946, NOINVERT, CONTROL, VIRTKEY
    VK_BACK, 714, NOINVERT, VIRTKEY
    VK_BACK, 714, NOINVERT, SHIFT, VIRTKEY
    VK_BACK, 32970, NOINVERT, CONTROL, VIRTKEY
    VK_BACK, 57643, NOINVERT, ALT, VIRTKEY
    VK_CANCEL, 32851, NOINVERT, CONTROL, VIRTKEY
    VK_DELETE, 57632, NOINVERT, VIRTKEY
    VK_DELETE, 32968, NOINVERT, CONTROL, VIRTKEY
    VK_DELETE, 57633, NOINVERT, ALT, VIRTKEY
    VK_DELETE, 57635, NOINVERT, SHIFT, VIRTKEY
    VK_DELETE, 635, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_DOWN, 620, NOINVERT, VIRTKEY
    VK_DOWN, 617, NOINVERT, CONTROL, VIRTKEY
    VK_DOWN, 639, NOINVERT, ALT, VIRTKEY
    VK_DOWN, 632, NOINVERT, SHIFT, VIRTKEY
    VK_DOWN, 641, NOINVERT, ALT, SHIFT, VIRTKEY
    VK_END, 612, NOINVERT, VIRTKEY
    VK_END, 610, NOINVERT, CONTROL, VIRTKEY
    VK_END, 637, NOINVERT, ALT, VIRTKEY
    VK_END, 626, NOINVERT, SHIFT, VIRTKEY
    VK_END, 624, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_NUMPAD1, 32990, NOINVERT, CONTROL, VIRTKEY
    VK_NUMPAD2, 32991, NOINVERT, CONTROL, VIRTKEY
    VK_NUMPAD3, 32992, NOINVERT, CONTROL, VIRTKEY
    VK_NUMPAD4, 32993, NOINVERT, CONTROL, VIRTKEY
    VK_NUMPAD5, 32994, NOINVERT, CONTROL, VIRTKEY
    VK_NUMPAD6, 32995, NOINVERT, CONTROL, VIRTKEY
    VK_NUMPAD7, 32996, NOINVERT, CONTROL, VIRTKEY
    VK_NUMPAD8, 32997, NOINVERT, CONTROL, VIRTKEY
    VK_NUMPAD9, 32998, NOINVERT, CONTROL, VIRTKEY
    VK_NUMPAD0, 32999, NOINVERT, CONTROL, VIRTKEY
    VK_F1, 57670, NOINVERT, VIRTKEY
    VK_F1, 32787, NOINVERT, CONTROL, VIRTKEY
    VK_F1, 57669, NOINVERT, SHIFT, VIRTKEY
    VK_F10, 709, NOINVERT, CONTROL, VIRTKEY
    VK_F10, 32835, NOINVERT, SHIFT, VIRTKEY
    VK_F11, 59397, NOINVERT, VIRTKEY
    VK_F11, 32950, NOINVERT, CONTROL, VIRTKEY
    VK_F11, 32949, NOINVERT, SHIFT, VIRTKEY
    VK_F12, 57604, NOINVERT, VIRTKEY
    VK_F2, 32942, NOINVERT, VIRTKEY
    VK_F2, 32941, NOINVERT, CONTROL, VIRTKEY
    VK_F2, 32943, NOINVERT, SHIFT, VIRTKEY
    VK_F2, 32944, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_F3, 32768, NOINVERT, VIRTKEY
    VK_F3, 59396, NOINVERT, CONTROL, VIRTKEY
    VK_F3, 32849, NOINVERT, ALT, VIRTKEY
    VK_F4, 32953, NOINVERT, VIRTKEY
    VK_F4, 32954, NOINVERT, SHIFT, VIRTKEY
    VK_F5, 32806, NOINVERT, VIRTKEY
    VK_F5, 32813, NOINVERT, CONTROL, VIRTKEY
    VK_F6, 57680, NOINVERT, VIRTKEY
    VK_F6, 57681, NOINVERT, SHIFT, VIRTKEY
    VK_F7, 33203, NOINVERT, VIRTKEY
    VK_F7, 33107, NOINVERT, CONTROL, VIRTKEY
    VK_F8, 32809, NOINVERT, VIRTKEY
    VK_F8, 32810, NOINVERT, CONTROL, VIRTKEY
    VK_F9, 32852, NOINVERT, VIRTKEY
    VK_F9, 32848, NOINVERT, CONTROL, VIRTKEY
    VK_HOME, 611, NOINVERT, VIRTKEY
    VK_HOME, 609, NOINVERT, CONTROL, VIRTKEY
    VK_HOME, 636, NOINVERT, ALT, VIRTKEY
    VK_HOME, 625, NOINVERT, SHIFT, VIRTKEY
    VK_HOME, 623, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_INSERT, 656, NOINVERT, VIRTKEY
    VK_INSERT, 57634, NOINVERT, CONTROL, VIRTKEY
    VK_INSERT, 57637, NOINVERT, SHIFT, VIRTKEY
    VK_LEFT, 621, NOINVERT, VIRTKEY
    VK_LEFT, 603, NOINVERT, CONTROL, VIRTKEY
    VK_LEFT, 633, NOINVERT, SHIFT, VIRTKEY
    VK_LEFT, 604, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_NEXT, 614, NOINVERT, VIRTKEY
    VK_NEXT, 616, NOINVERT, CONTROL, VIRTKEY
    VK_NEXT, 630, NOINVERT, SHIFT, VIRTKEY
    VK_NEXT, 629, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_PRIOR, 613, NOINVERT, VIRTKEY
    VK_PRIOR, 615, NOINVERT, CONTROL, VIRTKEY
    VK_PRIOR, 627, NOINVERT, SHIFT, VIRTKEY
    VK_PRIOR, 628, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_RETURN, 32962, NOINVERT, CONTROL, VIRTKEY
    VK_RETURN, 32946, NOINVERT, ALT, VIRTKEY
    VK_RETURN, 32961, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_RIGHT, 622, NOINVERT, VIRTKEY
    VK_RIGHT, 607, NOINVERT, CONTROL, VIRTKEY
    VK_RIGHT, 634, NOINVERT, SHIFT, VIRTKEY
    VK_RIGHT, 608, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_TAB, 32826, NOINVERT, CONTROL, VIRTKEY
    VK_TAB, 32827, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_UP, 619, NOINVERT, VIRTKEY
    VK_UP, 618, NOINVERT, CONTROL, VIRTKEY
    VK_UP, 638, NOINVERT, ALT, VIRTKEY
    VK_UP, 631, NOINVERT, SHIFT, VIRTKEY
    VK_UP, 640, NOINVERT, ALT, SHIFT, VIRTKEY
    VK_W, 607, NOINVERT, CONTROL, VIRTKEY
    VK_W, 608, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_X, 57635, NOINVERT, CONTROL, VIRTKEY
    VK_X, 32792, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_Y, 57644, NOINVERT, CONTROL, VIRTKEY
    VK_Y, 654, NOINVERT, CONTROL, SHIFT, VIRTKEY
    VK_Z, 57643, NOINVERT, CONTROL, VIRTKEY
    VK_Z, 653, NOINVERT, CONTROL, SHIFT, VIRTKEY
}

30997 ACCELERATORS
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
    VK_NEXT, 58114, NOINVERT, VIRTKEY
    VK_PRIOR, 58115, NOINVERT, VIRTKEY
    VK_ESCAPE, 58112, NOINVERT, VIRTKEY
}

1304 CURSOR "Cursor_1.cur"

1305 CURSOR "Cursor_2.cur"

1306 CURSOR "Cursor_3.cur"

1307 CURSOR "Cursor_4.cur"

1308 CURSOR "Cursor_5.cur"

1309 CURSOR "Cursor_6.cur"

20691 CURSOR "Cursor_7.cur"

20692 CURSOR "Cursor_8.cur"

20693 CURSOR "Cursor_9.cur"

23002 CURSOR "Cursor_10.cur"

23003 CURSOR "Cursor_11.cur"

23004 CURSOR "Cursor_12.cur"

23006 CURSOR "Cursor_13.cur"

30977 CURSOR "Cursor_14.cur"

30978 CURSOR "Cursor_15.cur"

30979 CURSOR "Cursor_16.cur"

30980 CURSOR "Cursor_17.cur"

30981 CURSOR "Cursor_18.cur"

30982 CURSOR "Cursor_19.cur"

30983 CURSOR "Cursor_20.cur"

30984 CURSOR "Cursor_21.cur"

30985 CURSOR "Cursor_22.cur"

30986 CURSOR "Cursor_23.cur"

30987 CURSOR "Cursor_24.cur"

30988 CURSOR "Cursor_25.cur"

30998 CURSOR "Cursor_26.cur"

30999 CURSOR "Cursor_27.cur"

31000 CURSOR "Cursor_28.cur"

31001 CURSOR "Cursor_29.cur"

31002 CURSOR "Cursor_30.cur"

31003 CURSOR "Cursor_31.cur"

31004 CURSOR "Cursor_32.cur"

31005 CURSOR "Cursor_33.cur"

31006 CURSOR "Cursor_34.cur"

31007 CURSOR "Cursor_35.cur"

31008 CURSOR "Cursor_36.cur"

31009 CURSOR "Cursor_37.cur"

31010 CURSOR "Cursor_38.cur"

31011 CURSOR "Cursor_39.cur"

2 ICON "Icon_1.ico"

3 ICON "Icon_2.ico"

4 ICON "Icon_3.ico"

2000 ICON "Icon_4.ico"

2001 ICON "Icon_5.ico"

2002 ICON "Icon_6.ico"

2003 ICON "Icon_7.ico"

2004 ICON "Icon_8.ico"

2005 ICON "Icon_9.ico"

2006 ICON "Icon_10.ico"

2007 ICON "Icon_11.ico"

20514 ICON "Icon_12.ico"

20515 ICON "Icon_13.ico"

1 VERSIONINFO
FILEVERSION 4,0,6,2
PRODUCTVERSION 4,0,6,2
FILEOS 0x40004
FILETYPE 0x1
{
BLOCK "StringFileInfo"
{
    BLOCK "040904e4"
    {
        VALUE "Comments", ""
        VALUE "CompanyName", "Helios Software Solutions"
        VALUE "FileDescription", "TextPad"
        VALUE "FileVersion", "4.6"
        VALUE "InternalName", "TextPad"
        VALUE "LegalCopyright", "Copyright © 1992-2003"
        VALUE "LegalTrademarks", "TextPad"
        VALUE "OriginalFilename", "TEXTPAD.EXE"
        VALUE "PrivateBuild", ""
        VALUE "ProductName", "TextPad"
        VALUE "ProductVersion", "4.6.2"
        VALUE "SpecialBuild", ""
    }
}

BLOCK "VarFileInfo"
{
    VALUE "Translation", 0x0409 0x04E4
}
}

1 24 "Data_1.bin"

2100 241 "Data_2.bin"

2101 241 "Data_3.bin"

2102 241 "Data_4.bin"

2103 241 "Data_5.bin"

2104 241 "Data_6.bin"

19000 241 "Data_7.bin"


File.RC Fontedit.exe

#include "fontedit.h"
#include "windows.h"

#define DLGMODAL WS_POPUP | WS_DLGFRAME | WS_VISIBLE
#define TABGRP	 WS_TABSTOP | WS_GROUP
#define VK_A	 97
#define VK_D	 100
#define VK_L	 108
#define VK_R	 114
#define VK_B	 98

BOX_CLEAR       CURSOR    fillclr.cur
BOX_FILL        CURSOR    fillsol.cur
BOX_INV         CURSOR    fillinv.cur
BOX_HATCH       CURSOR    fillhat.cur
BOX_LEFTRIGHT   CURSOR    filllft.cur
BOX_TOPBOTTOM   CURSOR    filltop.cur
BOX_COPY        CURSOR    fillcpy.cur
BOX_PASTE       CURSOR    fillpst.cur

fontedit icon    FONTEDIT.ICO

fontedit menu
begin
    POPUP "&File"
    begin
        MENUITEM "&New...", FONT_NEW
            MENUITEM "&Open...", FONT_LOAD
        MENUITEM "&Save", FONT_SAVE, GRAYED
        MENUITEM "Save &as...", FONT_SAVEAS, GRAYED
            MENUITEM SEPARATOR
            MENUITEM "E&xit", FONT_EXIT
        MENUITEM "A&bout Fontedit...", FONT_ABOUT
        end
    POPUP "&Edit", GRAYED
        begin
            MENUITEM "&Undo\tAlt+Bksp", BOX_UNDO, GRAYED
            MENUITEM SEPARATOR
            MENUITEM "&Copy\tCtrl+Ins", FONT_COPY
            MENUITEM "&Paste\tShift+Ins", FONT_PASTE, GRAYED
            MENUITEM SEPARATOR
            MENUITEM "&Refresh", BOX_REFRESH, GRAYED
        end
    POPUP "F&ont", GRAYED
        begin
            MENUITEM "&Size...", FONT_RESIZE
            MENUITEM "&Header...", FONT_HEADER
        end
    POPUP "F&ill", GRAYED
        begin
        MENUITEM "&Clear\tCtrl+C", BOX_CLEAR
        MENUITEM "&Solid\tCtrl+S", BOX_FILL
        MENUITEM "&Hatched\tCtrl+H", BOX_HATCH
        MENUITEM "&Inverted\tCtrl+I", BOX_INV
        MENUITEM "&Left=Right\tCtrl+F1", BOX_LEFTRIGHT
        MENUITEM "&Top=Bottom\tCtrl+F2", BOX_TOPBOTTOM
        MENUITEM "C&opy\tCtrl+O", BOX_COPY
        MENUITEM "&Paste\tCtrl+P", BOX_PASTE, GRAYED
        end
    POPUP "&Width", GRAYED
        begin
        MENUITEM "Wider (left)\tCtrl+L", WIDER_LEFT
        MENUITEM "Wider (right)\tCtrl+R", WIDER_RIGHT
        MENUITEM "Wider (both)\tCtrl+B", WIDER_BOTH
        MENUITEM "Narrower (left)\tL", NARROWER_LEFT
        MENUITEM "Narrower (right)\tR", NARROWER_RIGHT
        MENUITEM "Narrower (both)\tB", NARROWER_BOTH
            MENUITEM SEPARATOR
            MENUITEM "Width ...", WIDTH
        end
    POPUP "&Row", GRAYED
        begin
        MENUITEM "&Add", ROW_ADD
        MENUITEM "&Delete", ROW_DEL
        end
    POPUP "&Column", GRAYED
        begin
        MENUITEM "&Add", COL_ADD
        MENUITEM "&Delete", COL_DEL
        end
end

FE ACCELERATORS
BEGIN
    "^C", BOX_CLEAR
    "^S", BOX_FILL
    "^H", BOX_HATCH
    "^I", BOX_INV
    "^O", BOX_COPY
    "^P", BOX_PASTE

    "^L", WIDER_LEFT
    "^R", WIDER_RIGHT
    "^B", WIDER_BOTH

    VK_L, NARROWER_LEFT,  ASCII
    VK_R, NARROWER_RIGHT, ASCII
    VK_B, NARROWER_BOTH,  ASCII

    VK_F1,BOX_LEFTRIGHT , VIRTKEY, CONTROL
    VK_F2,BOX_TOPBOTTOM , VIRTKEY, CONTROL

    VK_INSERT, FONT_COPY,  VIRTKEY, CONTROL
    VK_INSERT, FONT_PASTE, VIRTKEY, SHIFT
    VK_BACK,   BOX_UNDO,   VIRTKEY, ALT
END

ABOUT DIALOG LOADONCALL MOVEABLE DISCARDABLE 22, 17, 160, 80
STYLE WS_DLGFRAME | WS_POPUP
BEGIN
           CONTROL "Microsoft Windows" -1, "static", SS_CENTER | WS_GROUP | WS_CHILD, 0, 5, 160, 8
           CONTROL "Font Editor" -1, "static", SS_CENTER | WS_GROUP | WS_CHILD, 0, 14, 160, 8
       CONTROL "Version 3.0" -1, "static", SS_CENTER | WS_GROUP | WS_CHILD, 30, 34, 94, 8
       CONTROL "Copyright © 1985-1995, Microsoft Corp." -1, "static", SS_CENTER | WS_GROUP | WS_CHILD, 0, 47, 160, 9
           CONTROL "fontedit" -1, "static", SS_ICON | WS_CHILD, 14, 13, 0, 0
           CONTROL "OK" IDOK, "button", BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP | WS_CHILD, 64, 59, 32, 14
END

IDD_OPEN DIALOG LOADONCALL MOVEABLE DISCARDABLE 10, 10, 198, 136
STYLE WS_DLGFRAME | WS_POPUP
BEGIN
       CONTROL "" ID_BOXOPEN,"static",SS_LEFT|WS_CHILD, 2,148,198,0
       CONTROL "FONTEDIT requires you to create a new font file" -1, "static",SS_LEFT|WS_GROUP|WS_CHILD, 2,2, 196,8
       CONTROL "by borrowing from an already existing file." -1, "static", SS_LEFT|WS_GROUP|WS_CHILD,2, 12, 196,8
       CONTROL "Open File &Name:" -1, "static", SS_LEFT | WS_GROUP | WS_CHILD, 2,24, 76, 10
       CONTROL "" ID_EDIT, "edit", ES_LEFT | ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP | WS_CHILD, 2, 37, 100, 12
       CONTROL "&Files in" -1, "static", SS_LEFT | WS_GROUP | WS_CHILD, 2, 59, 38, 10
       CONTROL "" ID_LISTBOX, "listbox", LBS_NOTIFY | LBS_SORT | LBS_STANDARD | WS_BORDER | WS_VSCROLL | WS_GROUP | WS_TABSTOP | WS_CHILD, 3, 73, 90, 57
       CONTROL "&Open" IDOK, "button", BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP | WS_CHILD,118, 82, 50, 16
       CONTROL "Cancel" IDCANCEL, "button", BS_PUSHBUTTON | WS_GROUP | WS_TABSTOP | WS_CHILD,118, 107, 50, 16
       CONTROL "" ID_PATH, "static", SS_LEFT | SS_NOPREFIX | WS_GROUP | WS_CHILD, 44, 59, 98, 12
END

IDD_SAVE DIALOG LOADONCALL MOVEABLE DISCARDABLE 10, 10, 140, 160
STYLE WS_DLGFRAME | WS_POPUP
BEGIN
       CONTROL "Save File &Name: " -1, "static", SS_LEFT | WS_GROUP | WS_CHILD, 2, 6,100, 12
       CONTROL "" ID_EDIT, "edit", ES_LEFT | ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP | WS_CHILD, 2, 20,110, 12
       CONTROL "" ID_PATH, "static", SS_LEFT | SS_NOPREFIX | WS_GROUP | WS_CHILD, 2,35, 98, 12
       CONTROL "&Directories" -1, "static", SS_LEFT | WS_GROUP | WS_CHILD, 2, 50, 45, 10
       CONTROL "" ID_LISTBOX, "listbox", LBS_NOTIFY | LBS_SORT | LBS_STANDARD | WS_BORDER | WS_VSCROLL | WS_GROUP | WS_TABSTOP | WS_CHILD, 3, 65, 70, 60
       CONTROL "OK" IDOK, "button", BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP | WS_CHILD, 90, 70, 40, 16
       CONTROL "Cancel" IDCANCEL, "button", BS_PUSHBUTTON | WS_GROUP | WS_TABSTOP | WS_CHILD, 90,100, 40, 16
       GROUPBOX "Font Format" 0, 7,127, 100,25
       RADIOBUTTON "2.0", ID_FORMAT2, 20, 137, 20, 12 ,WS_GROUP|WS_TABSTOP
       RADIOBUTTON "3.0", ID_FORMAT3, 80, 137, 20, 12

END

IDD_FORMAT DIALOG LOADONCALL MOVEABLE DISCARDABLE 46, 37, 141, 79
CAPTION "Save File Format"
STYLE WS_BORDER | WS_CAPTION | WS_DLGFRAME | DS_MODALFRAME | WS_POPUP
BEGIN
    CONTROL "OK", 1, "button", BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP | WS_CHILD, 20, 53, 40, 16
    CONTROL "Cancel", 2, "button", BS_PUSHBUTTON | WS_GROUP | WS_TABSTOP | WS_CHILD, 80, 53, 40, 16
    GROUPBOX "Font Format" 0, 23,10, 96,30
    RADIOBUTTON "2.0", ID_FORMAT2, 37, 21, 20, 12 ,WS_GROUP|WS_TABSTOP
    RADIOBUTTON "3.0", ID_FORMAT3, 85, 21, 20, 12

END

DWidth DIALOG 20, 20, 140, 50
STYLE WS_POPUP | WS_DLGFRAME | WS_VISIBLE
BEGIN
    LTEXT "Character Width", 0, 10, 7, 50, 20
    EDITTEXT BOX_WIDTH, 50, 5, 30, 12

    DEFPUSHBUTTON  "OK",      IDOK,     100,  5, 35, 14, WS_GROUP
    PUSHBUTTON     "Cancel",  IDCANCEL, 100, 23, 35, 14, WS_GROUP
END

DHeader DIALOG 10, 10, 282, 162
STYLE WS_POPUP | WS_DLGFRAME | WS_VISIBLE
BEGIN
    LTEXT "Face Name", 0, 10, 22, 43, 10
    EDITTEXT ID_FACE_NAME, 60, 20, 133, 12
    LTEXT "File Name", 300, 10, 7, 50, 10
    LTEXT "", ID_FONT_NAME, 52, 7, 65, 12
    LTEXT "Copyright: ", 301, 10, 37, 90, 10
    EDITTEXT ID_COPYRIGHT, 10, 47, 245, 12

    LTEXT "Nominal Point Size", 302, 10, 68, 60, 20
    EDITTEXT ID_POINTS, 65, 66, 17, 12, TABGRP
    LTEXT "Height of Ascent", 303, 90, 68, 60, 20
    EDITTEXT ID_ASCENT, 150, 66, 17, 12, TABGRP

    LTEXT "Nominal Vert. Resolution", 304, 10, 85, 60, 20
    EDITTEXT ID_VERT_RES, 65, 85, 17, 12 , TABGRP
    LTEXT "Nominal Horiz. Resolution", 305, 90, 85, 60, 20
    EDITTEXT ID_HORIZ_RES, 150, 85, 17, 12 , TABGRP

    LTEXT "External Leading", 306, 10, 104, 60, 20
    EDITTEXT ID_EXT_LEADING, 65, 104, 17, 12 , TABGRP
    LTEXT "Internal Leading", 307, 90, 104, 60, 20
    EDITTEXT ID_INT_LEADING, 150, 104, 17, 12, TABGRP

    LTEXT "Default Character", 308, 10, 123, 50, 20
    EDITTEXT ID_DEFAULT_CHAR, 65, 123, 17, 12, TABGRP
    LTEXT "Break Character", 309, 90, 123, 50, 20
    EDITTEXT ID_BREAK_CHAR, 150, 123, 17, 12, TABGRP

    GROUPBOX  "Character Set", 310, 174, 60, 104, 31
    RADIOBUTTON, "ShiftJIS", ID_SHIFTJIS, 215, 78, 40, 12 , TABGRP
    RADIOBUTTON, "ANSI", ID_ANSI, 177, 68, 35, 12
    RADIOBUTTON, "OEM", ID_OEM, 215, 68, 35, 12
    RADIOBUTTON, "SYMBOL", ID_SYMBOL, 177, 78, 40, 12
    EDITTEXT ID_CHAR_SET, 255, 66, 17, 12 ,TABGRP

    GROUPBOX  "Font Family", 311, 174, 92, 104, 50
    RADIOBUTTON "Roman", ID_ROMAN, 177, 102, 42, 12 , TABGRP
    RADIOBUTTON "Modern", ID_MODERN, 220, 102, 55, 12
    RADIOBUTTON "Swiss", ID_SWISS, 177, 114, 42, 12
    RADIOBUTTON "Decorative", ID_DECORATIVE, 220, 114, 55, 12
    RADIOBUTTON "Script", ID_SCRIPT, 177, 126, 42, 12
    RADIOBUTTON "Dontcare", ID_UNKNOWN, 220, 126, 55, 12

    CHECKBOX "Italic", ID_ITALIC, 10, 142, 60, 12 , TABGRP
    CHECKBOX "Underline", ID_UNDERLINE, 75, 142, 60, 12 , TABGRP
    CHECKBOX "Strikeout", ID_STRIKEOUT, 140, 142, 60, 12, TABGRP

    DEFPUSHBUTTON  "OK",      IDOK,     230,  5, 35, 14, WS_GROUP
    PUSHBUTTON     "Cancel",  IDCANCEL, 230, 23, 35, 14, WS_GROUP
END

DReSize DIALOG 10, 10, 200, 150
STYLE DLGMODAL
BEGIN
    LTEXT "", ID_WIDTH_TEXT, 10, 10, 50, 20     /* Filled in later */
    EDITTEXT ID_WIDTH, 65, 12, 13, 12 , TABGRP
    LTEXT "Character Pixel Height", 312, 10, 30, 50, 20
    EDITTEXT ID_PIX_HEIGHT, 65, 32 13, 12, TABGRP
    LTEXT "Average Width", 313, 110, 10, 50, 20
    LTEXT "", ID_AVERAGE, 160, 10, 17, 12
    LTEXT "First Character", 314, 10, 50, 50, 20
    EDITTEXT ID_FIRST_CHAR, 65, 52, 17, 12, TABGRP
    LTEXT "Last Character", 315, 10, 70, 50, 20
    EDITTEXT ID_LAST_CHAR, 65, 72, 17, 12, TABGRP

    GROUPBOX	 "Pitch",	   -1,	  10,  88, 65, 35,
    RADIOBUTTON, "Fixed",    ID_FIXED,	  20,  98, 45, 12, TABGRP
    RADIOBUTTON, "Variable", ID_VARIABLE, 20, 110, 45, 12,

    GROUPBOX	"Weight",	    -1,       110,  28, 70, 115
    RADIOBUTTON "Thin",        ID_THIN,       120,  40, 55, 11,TABGRP
    RADIOBUTTON "Extra Light", ID_EXTRALIGHT, 120,  51, 55, 11
    RADIOBUTTON "Light",       ID_LIGHT,      120,  62, 55, 11
    RADIOBUTTON "Normal",      ID_NORMAL,     120,  73, 55, 11
    RADIOBUTTON "Medium",      ID_MEDIUM,     120,  84, 55, 11
    RADIOBUTTON "Semi-Bold",   ID_SEMIBOLD,   120,  95, 55, 11
    RADIOBUTTON "Bold",        ID_BOLD,       120, 106, 55, 11
    RADIOBUTTON "Extra Bold",  ID_EXTRABOLD,  120, 117, 55, 11
    RADIOBUTTON "Heavy",       ID_HEAVY,      120, 128, 55, 11

    DEFPUSHBUTTON "OK",     IDOK,      10, 130,  35, 14, TABGRP
    PUSHBUTTON	  "Cancel", IDCANCEL,  56, 130,  35, 14, TABGRP
END

STRINGTABLE
BEGIN
    IDS_FILEREADONLY,"Warning : File is read only. Changes cannot will not be written to disk."
    IDS_NOMPTSIZENOTOK , "Nominal Point size must be number from 0-999"
    IDS_NOMVERTRESNOTOK, "Nominal Vertical Resolution must be number from 0-999"
    IDS_NOMHORRESNOTOK,  "Nominal Horizontal Resolution must be number from 0-999"
    IDS_ASCENTTOOBIG,  "Ascent cannot be greater than font height"
    IDS_ASCENTNOTOK, "Ascent must be number from 0-999"
    IDS_EXTLEADNOTOK,"External leading must be number from 0-999"
    IDS_INTLEADTOOBIG, "Internal leading must not be greater than Ascent"
    IDS_INTLEADNOTOK, "Internal leading must be number from 0-999"
    IDS_CHARSETOUTOFBOUNDS, "Character set must be number from 0-255"
    IDS_DEFCHAROUTSIDEFONT, "Default character must be within the font"
    IDS_DEFCHARNOTOK,"Default char must be number from 0-255"
    IDS_BREAKCHAROUTSIDEFONT, "Break char must be within the font"
    IDS_BREAKCHARNOTOK, "Break char must be number from 0-255"
    IDS_UNKNOWNFACE,"Font face must be specified -- 'Unknown' inserted"
    IDS_NOVARTOFIXCHANGE, "Cannot change width from variable to fixed"
    IDS_TOOBIGFOR20 "This resize will make font too big to save in 2.0 format. Save in 3.0 format?"
    IDS_HEIGHTOUTOFBOUNDS, "Font height must be number from 1-64 pixels"
    IDS_WIDTHOUTOFBOUNDS, "Fixed/maximum width must be number from 1-64"
    IDS_CHAR1MORETHANDCHAR, "First character cannot be more than Default character"
    IDS_CHAR1NOTOK,"First character must be number from 0-255"
    IDS_LASTCHARTOOSMALL,"Last character cannot be less than Default character"
    IDS_LASTCHARNOTOK, "Last character must be number from 0-255"
    IDS_CANNOTOPENCLIP, "Cannot open Clipboard"
    IDS_ERRORCLIP, "Error copying from Clipboard"
    IDS_COPYINGTOCLIP, "Copying to Clipbiard"
    IDS_NOTENOUGHMEM, "Not enough memory available"
    IDS_ALLOCATINGSPACE, "Allocating space"
    IDS_FONTEDIT, "FontEdit"
    IDS_FONTSHOW, "FontShow"
    IDS_DOTFNT, ".FNT"
    IDS_BLANKDASHBLANK, " - "
    IDS_ERROROPENINGFILE, "Error trying to open file"
    IDS_ERRORREADINGHDR, "Error reading header of font file"
    IDS_UNKNOWNFORMAT, "File not in known format"
    IDS_ERRORREADINGBODY, "Error reading body of font file"
    IDS_FILETOOLARGE, "Font file too large to save"
    IDS_ERRORWRITINGHDR, "Error writing header of font file"
    IDS_ERRORWRITINGOFFSETS, "Error writing offsets table of font file"
    IDS_ERRORWRITINGBODY, "Error writing body of font file"
    IDS_STARDOTFNT, "*.FNT"
    IDS_UNKNOWN, "Unknown"
    IDS_MAXWIDTH, "Maximum width"
    IDS_CHARPIXELWIDTH, "Character Pixel width"
    IDS_ABOUT, "ABOUT"
    IDS_DHEADER, "DHeader"
    IDS_DRESIZE, "DResize"
    IDS_DWIDTH, "DWidth"
    IDS_EDLIMITS0TO64, "Editor only handles widths 0-64"
    IDS_MAXWIDTHINCREASE, "Maximum width will be increased"
    IDS_CANNOTCHANGEWIDTH, "Cannot change width of a fixed width font"
    IDS_WARNING, "WARNING !"
    IDS_INCORRECTPIXWIDTH, "PixWidth field in header should be 0 for variable-width fonts"
    IDS_MAXWIDTHOUTOFBOUNDS, " Maximum width field in header must be number from 0-64"
    IDS_AVGWIDTHOUTOFBOUNDS, " Average width field in header must be number from 0-64"
    IDS_WIDTHBYTESNOTOK," WidthBytes field in header not OK"
    IDS_BITSOFFSETNOTOK," BitsOffset field in header cannot exceed 64kbytes in a 2.0 font"
    IDS_TABLEWIDTHSBAD, " Bad value(s) in width field(s) of offset table"
    IDS_TABLEOFFSETSBAD," Bad value(s) in offset field(s) of offset table"
    IDS_COLOR, "colors"
    IDS_APPWORKSPACE, "AppWorkspace"
    IDS_APPNAME,    "Font Editor"
    IDS_IFN,        "%% is not a valid filename."
    IDS_FNF,        "%% not found."
    IDS_REF,        "Replace existing %%?"
    IDS_SCC,        "%% has changed.  Save current changes?"
    IDS_EOF,        "Error opening %%"
    IDS_ECF,        "Error creating %%"
    IDS_FRO,        "Warning : File %% is read only. Changes will not be written to disk."
    IDS_EXT,        "*.FNT"
    IDS_EXTDESC,    "Font File (*.FNT)"
    IDS_NEW_FONT,   "FONTEDIT requires you to create a new font file by borrowing from an already existing file."
    IDS_CHAR,	"Char=%d"
    IDS_WIDTH,	"Width=%d"
    IDS_HEIGHT,	"Height=%d"
END


File include Fontedit.exe

#include <stdlib.h>

#define   WIDER_LEFT 1
#define   WIDER_RIGHT 2
#define   WIDER_BOTH 3
#define   NARROWER_LEFT 4
#define   NARROWER_RIGHT 5
#define   NARROWER_BOTH 6
#define   WIDTH 7
#define   BOX_WIDTH 8

#define   BOX_REFRESH 10                /* Restore char to original form */
#define   BOX_CLEAR 11
#define   BOX_FILL 12
#define   BOX_INV 13
#define   BOX_HATCH 14
#define   BOX_UNDO 15                   /* Undo last change */
#define   BOX_LEFTRIGHT 16              /* Flip left to right */
#define   BOX_TOPBOTTOM 17              /* Flip top over bottom */
#define   BOX_COPY 18
#define   BOX_PASTE 19

#define   ROW_ADD 21
#define   ROW_DEL 22

#define   COL_ADD 31
#define   COL_DEL 32

#define   ID_EDIT 34
#define   ID_PATH 35
#define   ID_LISTBOX 36
#define   ID_FACE_NAME 37
#define   ID_FONT_NAME 38
#define   ID_COPYRIGHT 39

#define   FONT_START 40                 /* Generated if win fontedit arg. */

#define   FONT_LOAD 41                  /* Codes for Font Window */
#define   FONT_SAVE 42
#define   FONT_HEADER 43
#define   FONT_COPY 44
#define   FONT_PASTE 45                 /* Paste in without rescaling */
#define   FONT_ABOUT 46                 /* Display the about box */
#define   FONT_RESIZE 47                /* Go to Resize Dialog Box */
#define   FONT_NEW 95                   /* Menu id: create new font */

#define   ID_FIRST_CHAR 48              /* First character in the font */
#define   ID_LAST_CHAR 49               /* Last character in the font */

#define   ID_POINTS 50                  /* Nominal Point Size */
#define   ID_VERT_RES 51                /* Nominal Vertical Resolution */
#define   ID_HORIZ_RES 52               /* Nominal Horizontal Resolution */
#define   ID_ASCENT 53                  /* Height of Ascent */
#define   ID_EXT_LEADING 54             /* Height of External Leading */
#define   ID_INT_LEADING 55             /* Height of Internal Leading */

#define   FONT_EXIT 56                  /* exit the font editor */

#define   ID_ITALIC 60                  /* Flag for Italic Fonts */
#define   ID_UNDERLINE 61               /* Flag for Underlined Fonts */
#define   ID_STRIKEOUT 62               /* Flag for Struckout Fonts */
#define   ID_ANSI 63                    /* 0 = ANSI, 255 = other */
#define   ID_OEM 64
#define   ID_CHAR_SET 65
#define   ID_DEFAULT_CHAR 66            /* Default for undefined Chars. */
#define   ID_BREAK_CHAR 67
#define   ID_SYMBOL 68

#define   ID_UNKNOWN 70
#define   ID_ROMAN 71
#define   ID_SWISS 72                   /* Pitch Families */
#define   ID_MODERN 73
#define   ID_SCRIPT 74
#define   ID_DECORATIVE 75

#define   ID_PIX_HEIGHT 80              /* Height of Characters */
#define   ID_WIDTH 81                   /* Fixed or Maximum Width */
#define   ID_WIDTH_TEXT 82              /* Caption for above */
#define   ID_AVERAGE 83                 /* Average Character Width */
#define   ID_FIXED 84                   /* Fixed Width Font */
#define   ID_VARIABLE 85                /* Variable width font */

#define   ID_THIN 86
#define   ID_EXTRALIGHT 87
#define   ID_LIGHT 88
#define   ID_NORMAL 89
#define   ID_MEDIUM 90
#define   ID_SEMIBOLD 91
#define   ID_BOLD 92
#define   ID_EXTRABOLD 93
#define   ID_HEAVY 94
#define   ID_BOXOPEN 96                /* dialog box frame id for File Open */
#define   FONT_SAVEAS 97

#define   ID_FORMAT2 102                /* Windows 2.0 Font Format */
#define   ID_FORMAT3 103                /* Windows 3.0 Font Format */

/* string IDS for strings in resource file - LR */
#define IDS_NOMPTSIZENOTOK          0
#define IDS_NOMVERTRESNOTOK         1
#define IDS_NOMHORRESNOTOK          2
#define IDS_ASCENTTOOBIG            3
#define IDS_ASCENTNOTOK             4
#define IDS_EXTLEADNOTOK            5
#define IDS_INTLEADTOOBIG           6
#define IDS_INTLEADNOTOK            7
#define IDS_CHARSETOUTOFBOUNDS      8
#define IDS_DEFCHAROUTSIDEFONT      9
#define IDS_DEFCHARNOTOK           10
#define IDS_BREAKCHAROUTSIDEFONT   11
#define IDS_BREAKCHARNOTOK         12
#define IDS_UNKNOWNFACE            13
#define IDS_NOVARTOFIXCHANGE       14
#define IDS_TOOBIGFOR20            15
#define IDS_HEIGHTOUTOFBOUNDS      16
#define IDS_WIDTHOUTOFBOUNDS       17
#define IDS_CHAR1MORETHANDCHAR     18
#define IDS_CHAR1NOTOK             19
#define IDS_LASTCHARTOOSMALL       20
#define IDS_LASTCHARNOTOK          21
#define IDS_CANNOTOPENCLIP         22
#define IDS_COPYINGTOCLIP          23
#define IDS_NOTENOUGHMEM           24
#define IDS_ALLOCATINGSPACE        25
#define IDS_FONTEDIT               26
#define IDS_FONTSHOW               27
#define IDS_DOTFNT                 28
#define IDS_BLANKDASHBLANK         29
#define IDS_ERROROPENINGFILE       30
#define IDS_ERRORREADINGHDR        31
#define IDS_UNKNOWNFORMAT          32
#define IDS_ERRORREADINGBODY       33
#define IDS_FILETOOLARGE           34
#define IDS_ERRORWRITINGHDR        35
#define IDS_ERRORWRITINGOFFSETS    36
#define IDS_ERRORWRITINGBODY       37
#define IDS_STARDOTFNT             38
#define IDS_UNKNOWN                39
#define IDS_MAXWIDTH               40
#define IDS_CHARPIXELWIDTH         41
#define IDS_ABOUT                  42
#define IDS_DHEADER                43
#define IDS_DRESIZE                44
#define IDS_DWIDTH                 45
#define IDS_EDLIMITS0TO64          46
#define IDS_MAXWIDTHINCREASE       47
#define IDS_CANNOTCHANGEWIDTH      48
#define IDS_WARNING                49
#define IDS_INCORRECTPIXWIDTH      50
#define IDS_MAXWIDTHOUTOFBOUNDS    51
#define IDS_AVGWIDTHOUTOFBOUNDS    52
#define IDS_WIDTHBYTESNOTOK        53
#define IDS_BITSOFFSETNOTOK        54
#define IDS_TABLEWIDTHSBAD         55
#define IDS_TABLEOFFSETSBAD        56
#define IDS_COLOR                  57
#define IDS_APPWORKSPACE           58
#define IDS_FILEREADONLY           59

#define     IDS_APPNAME            60
#define     IDS_IFN                61
#define     IDS_FNF                62
#define     IDS_REF                63
#define     IDS_SCC                64
#define     IDS_EOF                65
#define     IDS_ECF                66
#define     IDS_FRO                67
#define     IDS_EXT                68
#define     IDS_EXTDESC            69
#define     IDS_NEW_FONT           70
#define     IDS_ERRORCLIP          71
#define     IDS_CHAR		72
#define     IDS_WIDTH		73
#define     IDS_HEIGHT		74

#define CSTRINGS                   75   /* total number of strings in
                                           resource file */
#define CCHSTRINGSMAX              4096 /* total length of all strings
                                           loaded must be <= this */
#define CCHCOLORSTRING             15   /* size of App Workspace color inf.
                                           string loaded from win.ini */
#define ID_SHIFTJIS                76

/*****************************************************************************/
/*              Typedef's etc.                                               */
/*****************************************************************************/

// typedef unsigned char CHAR;  /* ... since we use these to index */

/* font file header (Adaptation Guide section 6.4) */
typedef struct {
    WORD        Version;              /* Always 17985 for the Nonce */
    DWORD       Size;                 /* Size of whole file */
    CHAR        Copyright[60];
    WORD        Type;                 /* Raster Font if Type & 1 == 0 */
    WORD        Points;               /* Nominal Point size */
    WORD        VertRes;              /* Nominal Vertical resolution */
    WORD        HorizRes;             /* Nominal Horizontal resolution */
    WORD        Ascent;               /* Height of Ascent */
    WORD        IntLeading;           /* Internal (Microsoft) Leading */
    WORD        ExtLeading;           /* External (Microsoft) Leading */
    BYTE        Italic;               /* Italic font if set */
    BYTE        Underline;            /* Etc. */
    BYTE        StrikeOut;            /* Etc. */
    WORD        Weight;               /* Weight: 200 = regular */
    BYTE        CharSet;              /* ANSI=0. other=255 */
    WORD        PixWidth;             /* Fixed width. 0 ==> Variable */
    WORD        PixHeight;            /* Fixed Height */
    BYTE        Family;               /* Pitch and Family */
    WORD        AvgWidth;             /* Width of character 'X' */
    WORD        MaxWidth;             /* Maximum width */
    BYTE        FirstChar;            /* First character defined in font */
    BYTE        LastChar;             /* Last character defined in font */
    BYTE        DefaultChar;          /* Sub. for out of range chars. */
    BYTE        BreakChar;            /* Word Break Character */
    WORD        WidthBytes;           /* No.Bytes/row of Bitmap */
    DWORD       Device;               /* Pointer to Device Name string */
    DWORD       Face;                   /* Pointer to Face Name String */
    DWORD       BitsPointer;            /* Pointer to Bit Map */
    DWORD       BitsOffset;             /* Offset to Bit Map */
} FontHeaderType;           /* Above pointers all rel. to start of file */

typedef struct {
    WORD        fsVersion;
    DWORD       fsSize;
    CHAR        fsCopyright[60];
    WORD        fsType;               /* Type field for the font              */
    WORD        fsPoints;             /* Point size of font                   */
    WORD        fsVertRes;            /* Vertical digitization                */
    WORD        fsHorizRes;           /* Horizontal digitization              */
    WORD        fsAscent;             /* Baseline offset from char cell top   */
    WORD        fsInternalLeading;    /* Internal leading included in font    */
    WORD        fsExternalLeading;    /* Prefered extra space between lines   */
    BYTE        fsItalic;             /* Flag specifying if italic            */
    BYTE        fsUnderline;          /* Flag specifying if underlined        */
    BYTE        fsStrikeOut;          /* Flag specifying if struck out        */
    WORD        fsWeight;             /* Weight of font                       */
    BYTE        fsCharSet;            /* Character set of font                */
    WORD        fsPixWidth;           /* Width field for the font             */
    WORD        fsPixHeight;          /* Height field for the font            */
    BYTE        fsPitchAndFamily;     /* Flag specifying pitch and family     */
    WORD        fsAvgWidth;           /* Average character width              */
    WORD        fsMaxWidth;           /* Maximum character width              */
    BYTE        fsFirstChar;          /* First character in the font          */
    BYTE        fsLastChar;           /* Last character in the font           */
    BYTE        fsDefaultChar;        /* Default character for out of range   */
    BYTE        fsBreakChar;          /* Character to define wordbreaks       */
    WORD        fsWidthBytes;         /* Number of bytes in each row          */
    DWORD       fsDevice;             /* Offset to device name                */
    DWORD       fsFace;               /* Offset to face name                  */
    DWORD       fsBitsPointer;        /* Bits pointer                         */
    DWORD       fsBitsOffset;         /* Offset to the begining of the bitmap */
    BYTE		fsDBfiller;			  /* Word alignment for the offset table  */

    DWORD       fsFlags;              /* Bit flags                            */
    WORD        fsAspace;             /* Global A space, if any               */
    WORD        fsBspace;             /* Global B space, if any               */
    WORD        fsCspace;             /* Global C space, if any               */
    DWORD       fsColorPointer;       /* offset to color table, if any        */
    DWORD       fsReserved[4];        /*                                      */
    BYTE        fsCharOffset;         /* Area for storing the char. offsets   */

} FontHeader30;

#define   CCHEXTRA             31     /* no. of extra bytes in the 3.0 header */

//
// These are the old glyph info structures.  Since they are not DWORD aligned
// they must be converted to new structure types.
//

typedef struct{
     SHORT GIwidth;
     SHORT GIoffset;
} GLYPHINFO_20;

typedef struct{
     SHORT GIwidth;
     LONG GIoffset;
} GLYPHINFO_30;

#define ClipBoard TRUE

LONG  APIENTRY FontEditWndProc(HWND, WORD, WPARAM, LONG);
LONG  APIENTRY FontShowWndProc(HWND, WORD, WPARAM, LONG);
BOOL  APIENTRY
HeaderProc(
    HWND   hDial,
    WORD   message,
    WPARAM wParam,
    LPARAM lParam
    );
BOOL APIENTRY
ReSizeProc(
    HWND   hDial,
    WORD   message,
    WPARAM wParam,
    LPARAM lParam
    );
BOOL  APIENTRY
WidthProc(
    HWND   hDial,
    WORD   message,
    WPARAM wParam,
    LPARAM lParam
    );

CHAR * FontLoad(CHAR *, OFSTRUCT *);
CHAR * FontSave(CHAR *, OFSTRUCT *);
BOOL ResizeBody();              /* Change Height of Font. MAde return type BOOL istead of VOID - LR */
BOOL ResizeWidths();            /* Change Widths (Fixed Width Fonts).MAde return type BOOL istead of VOID - LR  */
BOOL SpreadWidths(DWORD);            /* Change Widths (Var. Width Fonts). MAde return type BOOL istead of VOID - LR  */
VOID DeleteGlobalBitmap();
VOID ScrollFont();
VOID ExciseChars();             /* Delete part of a font */
BOOL
CharWidth(
    BYTE iChar,                             /* Character to change */
    DWORD wBox                               /* New width */
    );
BOOL NewLastChar(DWORD);             /* MAde return type BOOL istead of VOID - LR */
BOOL NewFirstChar(DWORD);            /* MAde return type BOOL istead of VOID - LR */
#define kBoxLim 65  /* was 49 */

#define wBoxLim 65
#define szNamesMax 32
#define BLACK (LONG)0
#define WHITE (LONG)0x00FFFFFF          /* For SetPixel rgbColor */
#define FILENAMEMAX _MAX_PATH   /* Maximum allowed length of file names */

/*********
 the following added 11-Sep-1986 to use dlgsave.c and dlgopen.c
**********/
#define   IDD_OPEN 1    /* dialog box ids */
#define   IDD_SAVE 2
#define   IDD_FORMAT 3

#define     MAX_STR_LEN     128
#define     MAX_FNAME_LEN   128
#define     CBEXTMAX        6   /* Number of bytes in "\*.ext" */

#define NOSAVE  0   /* return flags for DlgFnSave() */
#define NEWSAVE 1
#define OLDSAVE 2

#define NOOPEN  0   /* return flags for DlgFnOpen() */
#define NEWOPEN 1
#define OLDOPEN 2

#define WORD_LIMIT    65534    /* max. number of bytes that can be read(written) by */
#define SEGMENT_SIZE  65536    /* segment length in bytes */

/* abbreviations for accessing resource strings - LR */

#define vszNomPtSizeNotOk       vrgsz[IDS_NOMPTSIZENOTOK      ]
#define vszNomVertResNotOk      vrgsz[IDS_NOMVERTRESNOTOK     ]
#define vszNomHorResNotOk       vrgsz[IDS_NOMHORRESNOTOK      ]
#define vszAscentTooBig         vrgsz[IDS_ASCENTTOOBIG        ]
#define vszAscentNotOk          vrgsz[IDS_ASCENTNOTOK         ]
#define vszExtLeadNotOk         vrgsz[IDS_EXTLEADNOTOK        ]
#define vszIntLeadTooBig        vrgsz[IDS_INTLEADTOOBIG       ]
#define vszIntLeadNotOk         vrgsz[IDS_INTLEADNOTOK        ]
#define vszCharSetOutOfBounds   vrgsz[IDS_CHARSETOUTOFBOUNDS  ]
#define vszDefCharOutsideFont   vrgsz[IDS_DEFCHAROUTSIDEFONT  ]
#define vszDefCharNotOk         vrgsz[IDS_DEFCHARNOTOK        ]
#define vszBreakCharOutsideFont vrgsz[IDS_BREAKCHAROUTSIDEFONT]
#define vszBreakCharNotOk       vrgsz[IDS_BREAKCHARNOTOK      ]
#define vszUnknownFace          vrgsz[IDS_UNKNOWNFACE         ]
#define vszNoVarToFixChange     vrgsz[IDS_NOVARTOFIXCHANGE    ]
#define vszTooBigFor20          vrgsz[IDS_TOOBIGFOR20         ]
#define vszHeightOutOfBounds    vrgsz[IDS_HEIGHTOUTOFBOUNDS   ]
#define vszWidthOutOfBounds     vrgsz[IDS_WIDTHOUTOFBOUNDS    ]
#define vszChar1MoreThanDChar   vrgsz[IDS_CHAR1MORETHANDCHAR  ]
#define vszChar1NotOk           vrgsz[IDS_CHAR1NOTOK          ]
#define vszLastCharTooSmall     vrgsz[IDS_LASTCHARTOOSMALL    ]
#define vszLastCharNotOk        vrgsz[IDS_LASTCHARNOTOK       ]
#define vszCannotOpenClip       vrgsz[IDS_CANNOTOPENCLIP      ]
#define vszCopyingToClip        vrgsz[IDS_COPYINGTOCLIP       ]
#define vszNotEnoughMem         vrgsz[IDS_NOTENOUGHMEM        ]
#define vszAllocatingSpace      vrgsz[IDS_ALLOCATINGSPACE     ]
#define vszFontEdit             vrgsz[IDS_FONTEDIT            ]
#define vszFontShow             vrgsz[IDS_FONTSHOW            ]
#define vszDotFNT               vrgsz[IDS_DOTFNT              ]
#define vszBlankDashBlank       vrgsz[IDS_BLANKDASHBLANK      ]
#define vszErrorOpeningFile     vrgsz[IDS_ERROROPENINGFILE    ]
#define vszErrorReadingHdr      vrgsz[IDS_ERRORREADINGHDR     ]
#define vszUnknownFormat        vrgsz[IDS_UNKNOWNFORMAT       ]
#define vszErrorReadingBody     vrgsz[IDS_ERRORREADINGBODY    ]
#define vszFileTooLarge         vrgsz[IDS_FILETOOLARGE        ]
#define vszErrorWritingHdr      vrgsz[IDS_ERRORWRITINGHDR     ]
#define vszErrorWritingOffsets  vrgsz[IDS_ERRORWRITINGOFFSETS ]
#define vszErrorWritingBody     vrgsz[IDS_ERRORWRITINGBODY    ]
#define vszStarDotFNT           vrgsz[IDS_STARDOTFNT          ]
#define vszUnknown              vrgsz[IDS_UNKNOWN             ]
#define vszMaxWidth             vrgsz[IDS_MAXWIDTH            ]
#define vszCharPixelWidth       vrgsz[IDS_CHARPIXELWIDTH      ]
#define vszABOUT                vrgsz[IDS_ABOUT               ]
#define vszDHeader              vrgsz[IDS_DHEADER             ]
#define vszDResize              vrgsz[IDS_DRESIZE             ]
#define vszDWidth               vrgsz[IDS_DWIDTH              ]
#define vszEdLimits0To64        vrgsz[IDS_EDLIMITS0TO64       ]
#define vszMaxWidthIncrease     vrgsz[IDS_MAXWIDTHINCREASE    ]
#define vszCannotChangeWidth    vrgsz[IDS_CANNOTCHANGEWIDTH   ]
#define vszWarning              vrgsz[IDS_WARNING             ]
#define vszIncorrectPixWidth    vrgsz[IDS_INCORRECTPIXWIDTH   ]
#define vszMaxWidthOutOfBounds  vrgsz[IDS_MAXWIDTHOUTOFBOUNDS ]
#define vszAvgWidthOutOfBounds  vrgsz[IDS_AVGWIDTHOUTOFBOUNDS ]
#define vszWidthBytesNotOk      vrgsz[IDS_WIDTHBYTESNOTOK     ]
#define vszBitsOffsetNotOk      vrgsz[IDS_BITSOFFSETNOTOK     ]
#define vszTableWidthsBad       vrgsz[IDS_TABLEWIDTHSBAD      ]
#define vszTableOffsetsBad      vrgsz[IDS_TABLEOFFSETSBAD     ]
#define vszcolors               vrgsz[IDS_COLOR               ]
#define vszAppWorkspace         vrgsz[IDS_APPWORKSPACE        ]
#define vszFileReadOnly         vrgsz[IDS_FILEREADONLY        ]
#define vszErrorClip            vrgsz[IDS_ERRORCLIP           ]
#define vszCHAR			vrgsz[IDS_CHAR			]
#define vszWIDTH		vrgsz[IDS_WIDTH			]
#define vszHEIGHT		vrgsz[IDS_HEIGHT		]

/*------ fontedit.c -------*/
extern VOID ResizeShow(VOID);
extern VOID ScrollFont(VOID);
extern VOID CharToBox(BYTE);
extern VOID FontRename(CHAR *);
extern VOID BoxToChar(BYTE);
extern DWORD GetkStuff(VOID);

/*------ fontload.c -------*/
extern VOID ToClipboard(BYTE, DWORD, DWORD);
extern VOID BoxToClipboard(POINT, DWORD, DWORD);
extern DWORD ClipboardToBox(POINT, DWORD, DWORD, BOOL);

/*------ fontdlg.c -------*/
BOOL
CommDlgOpen (
    HWND   hWndParent,      /* window handle of parent window */
    OFSTRUCT *pOfstrIn,     /* ptr to current file OFSTRUCT (->cBytes=0 if no
                             * cur. file)*/
    CHAR  *pszNewNameIn,    /* ptr to array which will get new file's name */
    CHAR  *pszExtIn,        /* ptr to current default extension */
    CHAR  *pszAppNameIn,    /* ptr to application name */
    BOOL   fOpenType
    );

BOOL
CommDlgSaveAs(
    HANDLE hInstance,
    HWND   hWndParent,      /* window handle of parent window */
    OFSTRUCT *pOfstrIn,     /* ptr to current file OFSTRUCT (->cBytes=0 if no
                             * cur. file)*/
    CHAR  *pszNewNameIn,    /* ptr to array which will get new file's name
                             * (no path) */
    CHAR  *pszExtIn,        /* ptr to current default extension */
    CHAR  *pszAppNameIn     /* ptr to application name */
    );

BOOL
DlgMergeStrings(
    CHAR   *szSrc,
    CHAR   *szMerge,
    CHAR   *szDst
    );

/*------ fonthead.c -------*/
extern VOID ErrorBox(HWND, CHAR *);

/*------ fontchar.c -------*/
extern VOID ClearBox(VOID);

/*------ fontcvt.c --------*/

BOOL
fConvStructInit ();

VOID
vFontStructFromBuffer (
             PBYTE           pjSourceBuff,
            FontHeaderType  *pfhDestFHStruct
        );

VOID
vBufferFromFontStruct (
             FontHeaderType  *pfhSourceFHStruct,
            PBYTE           pjDestBuff
        );

VOID
vBufferFromFont30Struct (
             FontHeader30    *pfh3SourceFH3Struct,
            PBYTE           pjDestBuff
        );

VOID
vGlyphInfo20FromBuffer (
             PBYTE           pjSourceBuff,
            GLYPHINFO_20   *pgi2DestGI2Struct
        );

VOID
vGlyphInfo30FromBuffer (
             PBYTE           pjSourceBuff,
            GLYPHINFO_30   *pgi3DestGI3Struct
        );

VOID
vBufferFromGlyphInfo20 (
             GLYPHINFO_20    *pgi2SrcGI2Struct,
            PBYTE           pjDestBuff
        );

VOID
vBufferFromGlyphInfo30 (
             GLYPHINFO_30    *pgi3SrcGI3Struct,
            PBYTE           pjDestBuff
        );

// dword alligned size of DIB scan in bytes
#define CJ_DIB_SCAN(cx)  ((((cx) + 31) & ~31) >> 3)


Using the Resource Compiler

Using the Resource Compiler Vu dans TOOL.chm 503_Ko

The Microsoft® Windows® Resource Compiler (RC) is a tool used in building Win32®-based applications. This overview describes how to create a resource-definition (script) file, how to compile your application's resources, and how to add compiled resources to your application.


RC Resource-Definition Statements

The following are the RC resource-definition statements.

Resources

ACCELERATORS
BITMAP
CURSOR
DIALOG
DIALOGEX
FONT
ICON
MENU
MENUEX
MESSAGETABLE
POPUP
RCDATA
STRINGTABLE
User-Defined
VERSIONINFO

Controls

AUTO3STATE
AUTOCHECKBOX
AUTORADIOBUTTON
CHECKBOX
COMBOBOX
CONTROL
CTEXT
DEFPUSHBUTTON
EDITTEXT
GROUPBOX
ICON
LISTBOX
LTEXT
PUSHBOX
PUSHBUTTON
PUSHBUTTON
RADIOBUTTON
RTEXT
SCROLLBAR
STATE3

Statements

CAPTION
CHARACTERISTICS
CLASS
EXSTYLE
FONT
LANGUAGE
MENU
MENUITEM
STYLE
VERSION


MENU Resource

The MENU resource-definition statement specifies the contents of a menu resource. A menu resource is a collection of information that defines the appearance and function of an application menu. A menu is a special input tool that lets a user select commands and open submenus from a list of menu items.

Syntax

menuID MENU  [[optional-statements]]  {      item-definitions      . . .  }

Parameters

menuID
A number that identifies the menu. This value is either a unique string or a unique 16-bit unsigned integer value in the range of 1 to 65,535.
optional-statements
This parameter can be zero of more of the following statements:
Statement | Description
CHARACTERISTICS dword | User-defined information about a resource that can be used by tools that read and write resource files.
LANGUAGE language, sublanguage | Specifies the language for the resource. The parameters are constants from WINNT.H.
VERSION dword | User-defined version number for the resource that can be used by tools that read and write resource files.

Example

Following is an example of a complete MENU statement:

sample MENU
{
     MENUITEM "&Soup", 100
     MENUITEM "S&alad", 101
     POPUP "&Entree"
     {
          MENUITEM "&Fish", 200
          MENUITEM "&Chicken", 201, CHECKED
          POPUP "&Beef"
          {
               MENUITEM "&Steak", 301
               MENUITEM "&Prime Rib", 302
          }
     }
     MENUITEM "&Dessert", 103
}

See Also

MENUEX, MENUITEM, POPUP, ACCELERATORS, CHARACTERISTICS, DIALOG, LANGUAGE, RCDATA, STRINGTABLE, VERSION


STYLE Statement

The STYLE resource-definition statement sets the window style of the dialog box. The window style specifies whether the box is a pop-up or a child window.

Syntax

STYLE style

Parameters

style
Specifies the window style. This parameter takes an integer value or predefined name. The default style is WS_POPUP | WS_BORDER | WS_SYSMENU.

The following is a list of the predefined styles:
Style | Description
DS_LOCALEDIT | Specifies that edit controls in the dialog box will use memory in the application's data section. By default, all edit controls in dialog boxes use memory outside the application's data section. This feature can be suppressed by adding the DS_LOCALEDIT flag to the STYLE command for the dialog box. If this flag is not used, the EM_GETHANDLE and EM_SETHANDLE messages must not be used.
DS_MODALFRAME | Creates a dialog box with a modal dialog box frame that can be combined with a title bar and window menu by specifying the WS_CAPTION and WS_SYSMENU styles.
DS_NOIDLEMSG | Suppresses WM_ENTERIDLE messages that the system would otherwise send to the owner of the dialog box while the dialog box is displayed.
DS_SYSMODAL | Create a dialog box with the WS_EX_TOPMOST flag. This flag cannot be combined with the DS_CONTROL style. This flag is obsolete and is included for compatibility with 16-bit versions of Windows.
WS_BORDER | Creates a window that has a border.
WS_CAPTION | Creates a window that has a title bar (implies the WS_BORDER style).
WS_CHILD | Creates a child window. It cannot be used with the WS_POPUP style.
WS_CHILDWINDOW | Creates a child window that has the WS_CHILD style.
WS_CLIPCHILDREN | Excludes the area occupied by child windows when drawing within the parent window. Used when creating the parent window.
WS_CLIPSIBLINGS | Clips child windows relative to each other; that is, when a particular child window receives a WM_PAINT message, this style clips all other top-level child windows out of the region of the child window to be updated. (If the WS_CLIPSIBLINGS style is not given and child windows overlap, it is possible, when drawing in the client area of a child window, to draw in the client area of a neighboring child window.) For use with the WS_CHILD style only.
WS_DISABLED | Creates a window that is initially disabled.
WS_DLGFRAME | Creates a window with a modal dialog box frame but no title.
WS_GROUP | Specifies the first control of a group of controls in which the user can move from one control to the next by using the arrow keys. All controls defined with the WS_GROUP style after the first control belong to the same group. The next control with the WS_GROUP style ends the style group and starts the next group (that is, one group ends where the next begins). This style is valid only for controls.
WS_HSCROLL | Creates a window that has a horizontal scroll bar.
WS_ICONIC | Creates a window that is initially iconic. For use with the WS_OVERLAPPED style only.
WS_MAXIMIZE | Creates a window of maximum size.
WS_MAXIMIZEBOX | Creates a window that has a maximize button.
WS_MINIMIZE | Creates a window of minimum size.
WS_MINIMIZEBOX | Creates a window that has a minimize button.
WS_OVERLAPPED | Creates an overlapped window. An overlapped window has a caption and a border.
WS_OVERLAPPED
WINDOW 		Creates an overlapped window having the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles.
WS_POPUP | Creates a pop-up window. It cannot be used with the WS_CHILD style.
WS_POPUPWINDOW | Creates a pop-up window that has the WS_POPUP, WS_BORDER, and WS_SYSMENU styles. The WS_CAPTION style must be combined with the WS_POPUPWINDOW style to make the System menu visible.
WS_SIZEBOX | Creates a window that has a size box. Used only for windows with a title bar or with vertical and horizontal scroll bars.
WS_SYSMENU | Creates a window that has a window menu in its title bar. Used only for windows with title bars. If used with a child window, this style creates a close button instead of a window menu.
WS_TABSTOP | Specifies one of any number of controls through which the user can move by using the TAB key. The TAB key moves the user to the next control specified by the WS_TABSTOP style. This style is valid only for controls.
WS_THICKFRAME | Creates a window with a thick frame that can be used to size the window.
WS_VISIBLE | Creates a window that is initially visible. This applies to overlapping and pop-up windows. For overlapping windows, the y parameter is used as a parameter for the ShowWindow function.
WS_VSCROLL | Creates a window that has a vertical scroll bar.

Remarks

If the predefined names are used, you must include WINDOWS.H.


Common Control Parameters

The following describes the general syntax for a control resource-definition statement, represented by control. The meaning of each parameter is given below. Occasionally, a statement will use a parameter differently, or may ignore a parameter. The statement-specific variation is described in the documentation for the statement.

Syntax

control [[text,]] id, x, y, width, height [[, style [[, extended-style]]]][, helpId]
      [{          data-element-1 [,          data-element-2 [,          ... ]]      }]

Parameters

text
Specifies text that is displayed with the control. The text is positioned within the control's specified dimensions or adjacent to the control.

This parameter must contain zero or more characters enclosed in double quotation marks ("). Strings are automatically null-terminated and converted to Unicode in the resulting resource file.

By default, the characters listed between the double quotation marks are ANSI characters, and escape sequences are interpreted as byte escape sequences. If the string is preceded by the L prefix, the string is a wide-character string and escape sequences are interpreted as 2-byte escape sequences that specify Unicode characters. If a double quotation mark is required in the text, you must include the double quotation mark twice.

An ampersand (&) character in the text indicates that the following character is used as a mnemonic character for the control. When the control is displayed, the ampersand is not shown, but the mnemonic character is underlined. The user can choose the control by pressing the key corresponding to the underlined mnemonic character. To use the ampersand as a character in a string, insert two ampersands (&&).

id
Specifies the control identifier. This value must be a 16-bit unsigned integer in the range 0 through 65,535 or a simple arithmetic expression that evaluates to a value in that range.
x
Specifies the x-coordinate of the left side of the control relative to the left side of the dialog box. This value must be a 16-bit unsigned integer in the range 0 through 65,535. The coordinate is in dialog units and is relative to the origin of the dialog box, window, or control containing the specified control.
y
Specifies the y-coordinate of the top side of the control relative to the top of the dialog box. This value must be a 16-bit unsigned integer in the range 0 through 65,535. The coordinate is in dialog units relative to the origin of the dialog box, window, or control containing the specified control.
width
Specifies the width of the control. This value must be a 16-bit unsigned integer in the range 1 through 65,535. The width is in 1/4-character units.
height
Specifies the height of the control. This value must be a 16-bit unsigned integer in the range 1 through 65,535. The height is in 1/8-character units.
style
Specifies the control styles. Use the bitwise OR (|) operator to combine styles.
extended-style
Specifies extended window styles. You must specify style to specify extended-style. For more information, see EXSTYLE.
helpID
Specifies a numeric expression indicating the ID used to identify the control during WM_HELP processing.
controlData
Specifies the control-specific data for the control. When a dialog is created, and a control in that dialog which has control-specific data is created, a pointer to that data is passed into the control's window procedure via the lParam to the WM_CREATE message for that control.

Remarks

Horizontal dialog units are 1/4 of the dialog base width unit. Vertical units are 1/8 of the dialog base height unit. The current dialog base units are computed from the height and width of the current system font. The GetDialogBaseUnits function returns the dialog base units in pixels. The coordinates are relative to the origin of the dialog box.


A

Accelerator Type required (ASCII or VIRTKEY)
The type parameter in the ACCELERATORS statement must contain either the ASCII or VIRTKEY value.


B

BEGIN expected in Accelerator Table
An ACCELERATORS statement was not followed by the BEGIN keyword.
BEGIN expected in Dialog
A DIALOG statement was not followed by the BEGIN keyword.
BEGIN expected in menu
A MENU statement was not followed by the BEGIN keyword.
BEGIN expected in RCData
An RCDATA statement was not followed by the BEGIN keyword.
BEGIN expected in String Table
A STRINGTABLE statement was not followed by the BEGIN keyword.
BEGIN expected in VERSIONINFO resource
A VERSIONINFO statement was not followed by the BEGIN keyword.
Bitmap file resource-file is not in version-number format.
Use Microsoft Image Editor (IMAGEDIT.EXE) to convert old resource files to the current format.


C

Cannot Re-use String Constants
You are using the same value twice in a STRINGTABLE statement. Make sure that you have not mixed overlapping decimal and hexadecimal values.
Control Character out of range [A – Z]
A control character in the ACCELERATORS statement is invalid. The character following the caret (^) must be in the range A through Z.
Could not open in-file-name
Microsoft Windows 32 Resource Compiler (RC) could not open the specified file. Make sure that the file exists and that you typed the filename correctly.
Couldn't open resource-name
Microsoft Windows 32 Resource Compiler (RC) could not open the specified file. Make sure that the file exists and that you typed the filename correctly.
Creating resource-name
(V) Microsoft Windows 32 Resource Compiler (RC) is creating a new binary resource (.RES) file.


E

Empty menus not allowed
An END keyword appears before any menu items are defined in the MENU statement. Empty menus are not permitted by Microsoft Windows 32 Resource Compiler (RC). Make sure that you do not have any opening quotation marks within the MENU statement.
END expected in Dialog
The END keyword must appear at the end of a DIALOG statement. Make sure that there are no opening quotation marks left from the preceding statement.
END expected in menu
The END keyword must appear at the end of a MENU statement. Make sure that there are no mismatched BEGIN and END statements.
Error Creating resource-name
Microsoft Windows 32 Resource Compiler (RC) could not create the specified binary resource (.RES) file. Make sure that it is not being created on a read-only drive. Use the /voption to find out whether the file is being created.
Expected Comma in Accelerator Table
Microsoft Windows 32 Resource Compiler (RC) requires a comma between the event and idvalue parameters in the ACCELERATORS statement.
Expected control class name
The class parameter of a CONTROL statement in the DIALOG statement must be one of the following control types: BUTTON, COMBOBOX, EDIT, LISTBOX, SCROLLBAR, STATIC, or user-defined. Make sure that the class is spelled correctly.
Expected font face name
The typeface parameter of the FONT statement in the DIALOG statement must be a character string enclosed in double quotation marks ("). This parameter specifies the name of a font.
Expected ID value for Menuitem
The MENU statement must contain a MENUITEM statement, which has either an integer or a symbolic constant in the MenuID parameter.
Expected Menu String
Each MENUITEM and POPUP statement must contain a text parameter. This parameter is a string enclosed in double quotation marks (") that specifies the name of the menu item or pop-up menu. A MENUITEM SEPARATOR statement requires no quoted string.
Expected numeric command value
Microsoft Windows 32 Resource Compiler (RC) was expecting a numeric idvalue parameter in the ACCELERATORS statement. Make sure that you have used a #define constant to specify the value and that the constant used is spelled correctly.
Expected numeric constant in string table
A numeric constant, defined in a #define statement, must immediately follow the BEGIN keyword in a STRINGTABLE statement.
Expected numeric point size
The pointsize parameter of the FONT statement in the DIALOG statement must be an integer point-size value.
Expected Numerical Dialog constant
A DIALOG statement requires integer values for the x, y, width, and height parameters. Make sure that these values, which are included after the DIALOG keyword, are not negative.
Expected String in STRINGTABLE
A string is expected after each numeric stringid parameter in a STRINGTABLE statement.
Expected String or Constant Accelerator command
Microsoft Windows 32 Resource Compiler (RC) was not able to determine which key was being set up for the accelerator. The event parameter in the ACCELERATORS statement might be invalid.
Expected VALUE, BLOCK, or END keyword.
The VERSIONINFO structure requires a VALUE, BLOCK, or END keyword.
Expecting number for ID
A number is expected for the id parameter of a CONTROL statement in the DIALOG statement. Make sure that you have a number or a #define statement for the control identifier.
Expecting quoted string for key
The key string following the BLOCK or VALUE keyword should be enclosed in double quotation marks.
Expecting quoted string in dialog class
The class parameter of the CLASS statement in the DIALOG statement must be an integer or a string enclosed in double quotation marks (").
Expecting quoted string in dialog title
The captiontext parameter of the CAPTION statement in the DIALOG statement must be a character string, enclosed in double quotation marks (").


F

File not found: filename
The file specified in the rc command was not found. Make sure that the file has not been moved to another directory and that the filename or path is typed correctly.
Font names must be ordinals
The pointsize parameter in the FONT statement must be an integer, not a string.


I

Invalid Accelerator
An event parameter in the ACCELERATORS statement was not recognized or was more than two characters long.
Invalid Accelerator Type (ASCII or VIRTKEY)
The type parameter in the ACCELERATORS statement must contain either the ASCII or VIRTKEY value.
Invalid control character
A control character in the ACCELERATORS statement is invalid. A valid control character consists of a caret (^) followed by a single letter.
Invalid Control type
The control statement in a DIALOG statement must be one of the following: AUTO3STATE, AUTOCHECKBOX, AUTORADIOBUTTON, CHECKBOX, COMBOBOX, CONTROL, CTEXT, DEFPUSHBUTTON, EDITTEXT, GROUPBOX, ICON, LISTBOX, LTEXT, PUSHBOX, PUSHBUTTON, RADIOBUTTON, RTEXT, SCROLLBAR, STATE3.
Invalid directive in preprocessed RC file
The specified filename has an embedded newline character.
Invalid .EXE file
The executable (.EXE) file is invalid. Make sure that the linker created it correctly and that the file exists.
Invalid switch, option
An option used was invalid. For a list of the command-line options, use the rc /? command.
Invalid switch, too many -D switches
Too many -d options were specified. To define a large number of symbols, use the #include directive to include a file of definitions.
Invalid type
The resource type was not among the types defined in the include file.
Invalid usage. Use RC -? for Help
Make sure that you have at least one filename to work with. For a list of the command-line options, use the rc -? command.
I/O error reading file
Read failed. Since this is a generic routine, no specific filename is supplied.
I/O error seeking in file
Seeking in file failed. Since this is a generic routine, no specific filename is supplied.
I/O error writing file
Write failed. Since this is a generic routine, no specific filename is supplied.


N

No resource binary filename specified.
The /fo option was used, but no binary resource (.RES) file was specified.


O

Old DIB in resource-name. Pass it through IMAGEDIT.
The resource file specified is not compatible with Win32. Make sure you have read and saved this file using the latest version of Microsoft Image Editor (IMAGEDIT.EXE).
Out of heap memory
There was not enough memory.
Out of memory, needed n bytes
Microsoft Windows 32 Resource Compiler (RC) was not able to allocate the specified amount of memory.


R

Redefinition of Button Type
The specified button styles conflict with or modify the style specified by the control keyword. This is a warning only and may be ignored.

The following common method of declaring an automatic radio button generates this warning:

RADIOBUTTON "&Italic", MYRB_ITALIC, 10, 10, 30, 12, BS_AUTORADIOBUTTON

To avoid the warning, use the control statement appropriate for the type of button that you want to define. In this example, the corrected statement is:

AUTORADIOBUTTON "&Italic", MYRB_ITALIC, 10, 10, 30, 12
RC: Invalid switch: option
An option used was invalid. For a list of the command-line options, use the rc /? command.
RC: RCPP.ERR not found
The RCPP.ERR file must be in the current directory or in a directory specified in the PATH environment variable.
RC terminated by user
A CTRL+C key combination was pressed, exiting Microsoft Windows 32 Resource Compiler (RC).
RC terminating after preprocessor errors
For information about preprocessor errors, see the documentation for the preprocessor.
Resource file resource-name is not in version-number format.
Make sure your icons and cursors have been read and saved using the latest version of Microsoft Image Editor (IMAGEDIT.EXE).


T

Text string or ordinal expected in Control
The text parameter of a CONTROL statement in the DIALOG statement must be either a text string or an ordinal reference to the type of control that is expected. If using an ordinal, make sure that you have a #define statement for the control.


U

Unable to create destination
Microsoft Windows 32 Resource Compiler (RC) was not able to create the destination file. Make sure that there is enough disk space.
Unbalanced Parentheses
Make sure that you have closed every opening parenthesis in the DIALOG statement.
Unexpected value in RCData
The values for the raw-data parameter in the RCDATA statement must be integers or strings, separated by commas. Make sure that you did not leave out a comma or a quotation mark around a string.
Unexpected value in value data
A statement contained information with a format or size different from the expected value for that parameter.
Unknown DIB header format
The device-independent bitmap (DIB) header is not a BITMAPCOREHEADER or BITMAPINFOHEADER structure.
Unknown Menu SubType
The item-definitions parameter of the MENU statement can contain only MENUITEM and POPUP statements.
Unrecognized VERSIONINFO field; BEGIN or comma expected
The format of the information following a VERSIONINFO statement is incorrect.


V

Version WORDs separated by commas expected
Values in an information block for a VERSIONINFO statement should be separated by commas.


W

Warning: ASCII character not equivalent to virtual key code
An invalid virtual-key code exists in the ACCELERATORS statement. The ASCII values for some characters such as *, ^, or & are not equivalent to the virtual-key codes for the corresponding keys. In the case of the asterisk (*), the virtual-key code is equivalent to the ASCII value for 8, the numeric character on the same key. Therefore, the statement VIRTKEY '*' is invalid.
Warning: SHIFT or CONTROL used without VIRTKEY
The ALT, SHIFT, and CONTROL options apply only to virtual keys in the ACCELERATORS statement. Make sure that the VIRTKEY option is used with one of these other options.
Writing resource type image lang:language size:size
(V) Microsoft Windows 32 Resource Compiler (RC) is writing the specified resource. The type is the resource type. It may be a number or a string. The image can be a number or a string. The language is the national language of the resource. The size is the decimal size of the resource in bytes.


Controls

A control is a child window an application uses in conjunction with another window to perform simple input and output (I/O) tasks. Controls are most often used within dialog boxes, but they can also be used in other windows. Controls within dialog boxes provide the user with the means to type text, choose options, and direct a dialog box to complete its action. Controls in other windows provide a variety of services, such as letting the user choose commands, view status, and view and edit text.

Controls, like other windows, each belong to a window class, either predefined or owner-defined. The window class and the corresponding window procedure define the properties of the control, its appearance, behavior, and purpose. An application can create controls individually by specifying the name of the window class when calling the CreateWindowEx function. An application can also direct the system to create controls for a dialog box by specifying the controls in the dialog box template.


Predefined Controls

The system provides several predefined window classes for controls. Controls belonging to these window classes are called predefined controls. An application creates a predefined control of a particular type by specifying the appropriate window class name in either the CreateWindowEx function or the dialog box template. The following are the predefined window classes.

Name | Description
BUTTON | Creates button controls. These controls typically notify the parent window when the user chooses the control. For more information, see Buttons.
COMBOBOX | Creates combo boxes. These controls are a combination of list boxes and edit controls, letting the user choose and edit items. For more information, see Combo Boxes.
EDIT | Creates edit controls. These controls let the user view and edit text. For more information, see Edit Controls.
LISTBOX | Creates list boxes. These controls display a list from which the user can select one or more items. For more information, see List Boxes.
RichEdit | Creates Rich Edit version 1.0 controls. These controls let the user view and edit text with character and paragraph formatting, and can include embedded COM objects. For more information, see Rich Edit Controls.
RICHEDIT_CLASS | Creates Rich Edit version 2.0 controls. These controls let the user view and edit text with character and paragraph formatting, and can include embedded COM objects. For more information, see Rich Edit Controls.
SCROLLBAR | Creates scroll bar controls. These controls let the user choose the direction and distance to scroll information in a related window. For more information, see Scroll Bars.
STATIC | Creates static controls. These controls often act as labels for other controls. For more information, see Static Controls.

Each predefined window class has a corresponding set of control styles that enable an application to vary the appearance and behavior of the controls it creates. For example, the BUTTON class supports styles to create push buttons, radio buttons, check boxes, and group boxes. An application specifies the style when creating the control.

Each predefined window class has a corresponding set of notification and control messages. Applications rely on the notification messages to determine when the user has provided input to the controls. For example, a push button sends a BN_CLICKED message to the parent window when the user clicks the button. Applications use the control messages to retrieve information from the controls and to manipulate the appearance and behavior of the controls. For example, an application can send a BM_GETCHECK message to a check box to determine whether it currently contains a check mark.

Most applications make extensive use of predefined controls in dialog boxes and other windows. Because predefined controls offer many capabilities, a full discussion of each is beyond the scope of this topic.


Animation Controls

An animation control is a window that displays an Audio-Video Interleaved (AVI) clip. An AVI clip is a series of bitmap frames like a movie. Animation controls can only display AVI clips that do not contain audio.

About Animation Controls

One common use for an animation control is to indicate system activity during a lengthy operation. This is possible because the operation thread continues executing while the AVI clip is displayed. For example, the Find dialog box of Microsoft® Windows® Explorer displays a moving magnifying glass as the system searches for a file.

Note If you are using ComCtl32.dll version 6 the thread is not supported, therefore make sure that your application does not block the UI or the animation will not occur.

An animation control can display an AVI clip originating from either an uncompressed AVI file or from an AVI file that was compressed using run-length (BI_RLE8) encoding. You can add the AVI clip to your application as an AVI resource, or the clip can accompany your application as a separate AVI file.

Note The AVI file, or resource, must not have a sound channel. The capabilities of the animation control are very limited and are subject to change. If you need a control to provide multimedia playback and recording capabilities for your application, you can use the MCIWnd control. For more information about the MCIWnd control, see the multimedia documentation in the Platform SDK.

Animation Control Creation

An animation control belongs to the ANIMATE_CLASS window class. You create an animation control by using the CreateWindow function or the Animate_Create macro. The macro positions the animation control in the upper-left corner of the parent window and, if the ACS_CENTER style is not specified, sets the width and height of the control based on the dimensions of a frame in the AVI clip. If ACS_CENTER is specified, Animate_Create sets the width and height of the control to zero. You can use the SetWindowPos function to set the position and size of the control.

If you create an animation control within a dialog box or from a dialog box resource, the control is automatically destroyed when the user closes the dialog box. If you create an animation control within a window, you must explicitly destroy the control.

About Animation Control Messages

An application sends messages to an animation control to open, play, stop, and close the corresponding AVI clip. Each message has one or more macros that you can use instead of sending the message explicitly.

After creating an animation control, an application sends the ACM_OPEN message to open an AVI clip and load it into memory. The message specifies either the path of an AVI file or the name of an AVI resource. The system loads the AVI resource from the module that created the animation control.

If the animation control has the ACS_AUTOPLAY style, the control begins playing the AVI clip immediately after the AVI file or AVI resource is opened. Otherwise, an application can use the ACM_PLAY message to start the AVI clip. An application can stop the clip at any time by sending the ACM_STOP message. The last frame played remains displayed when the control finishes playing the AVI clip or when ACM_STOP is sent.

An animation control can send two notification messages, ACN_START and ACN_STOP , to its parent window. Most applications do not handle either notification.

To close the AVI file or AVI resource and remove it from memory, an application can use the Animate_Close macro, which sends ACM_OPEN with the file name or resource name set to NULL.

Default Message Processing

This section describes the window messages handled by the window procedure for the ANIMATE_CLASS window class.

Message | Processing performed
WM_CLOSE | Frees the AVI file or AVI resource associated with the animation control.
WM_DESTROY | Frees the AVI file or AVI resource, frees an internal data structure, and then calls the DefWindowProc function.
WM_ERASEBKGND | Erases the window background using the current background color for static controls.
WM_NCCREATE | Allocates and initializes an internal data structure and then calls DefWindowProc.
WM_NCHITTEST | Returns the HTTRANSPARENT hit test value.
WM_PAINT | Draws an AVI frame in the animation control.
WM_SIZE | Checks if the control has the ACS_CENTER style. If the control does not, it calls DefWindowProc. Otherwise, it centers the animation in the control, invalidates the control, and then calls DefWindowProc.

Creating an Animation Control

The following function creates an animation control in a dialog box. The animation control is positioned below the specified control, and the dimensions of the animation control are based on the dimensions of a frame in the AVI clip.

// CreateAnimationCtrl - creates an animation control, positions it
//                       below the specified control in a dialog box,
//                       and opens the AVI clip for the animation control.
// Returns the handle to the animation control.
// hwndDlg             - handle to the dialog box.
// nIDCtl              - identifier of the control below which the animation control
//                       is to be positioned.
//
// Constants
//     IDC_ANIMATE - identifier of the animation control.
//     CX_FRAME, CY_FRAME - width and height of the frames
//     in the AVI clip.

HWND CreateAnimationCtrl(HWND hwndDlg, int nIDCtl)
{
    HWND hwndAnim = NULL;
    RECT rc;
    POINT pt;

    // Create the animation control.
    hwndAnim = Animate_Create(hwndDlg, IDC_ANIMATE,
        WS_BORDER | WS_CHILD, g_hinst);

    // Get the screen coordinates of the specified control button.
    GetWindowRect(GetDlgItem(hwndDlg, nIDCtl), &rc);

    // Convert the coordinates of the lower-left corner to
    // client coordinates.
    pt.x = rc.left;
    pt.y = rc.bottom;
    ScreenToClient(hwndDlg, &pt);

    // Position the animation control below the Stop button.
    SetWindowPos(hwndAnim, 0, pt.x, pt.y + 20,
        CX_FRAME, CY_FRAME,
        SWP_NOZORDER | SWP_DRAWFRAME);

    // Open the AVI clip, and show the animation control.
    Animate_Open(hwndAnim, "SEARCH.AVI");
    ShowWindow(hwndAnim, SW_SHOW);

    return hwndAnim;
}

Controlling the AVI Clip

The following function uses the animation control macros to control the display of the AVI clip in an animation control.

// DoAnimation - plays, stops, or closes an animation control's
//               AVI clip, depending on the value of an action flag.
// hwndAnim    - handle to an animation control
// nAction     - flag that determines whether to play, stop, or close
//               the AVI clip.

void DoAnimation(HWND hwndAnim, int nAction)
{
    switch (nAction) {
        case PLAYIT:
         // Play the clip continuously starting with the
         // first frame.
            Animate_Play(hwndAnim, 0, -1, -1);
            break;

        case STOPIT:
            Animate_Stop(hwndAnim);
            break;

        case CLOSEIT:
            Animate_Close(hwndAnim);
            break;

        default:

            break;

    }

    return;
}


Buttons

Dialog boxes and controls support communication between an application and the user. A button is a control the user can click to provide input to an application.

There are several types of buttons and one or more button styles to distinguish among buttons of the same type. The user clicks a button using the mouse or keyboard. Clicking a button typically changes its visual appearance and state (from checked to cleared, for example). The system, the button, and the application cooperate in changing the button's appearance and state. A button can send messages to its parent window, and a parent window can send messages to a button. Some buttons are painted by the system, some by the application. Buttons can be used alone or in groups and can appear with or without application-defined text (a label). They belong to the BUTTON window class.

Although an application can use buttons in overlapped, pop-up, and child windows, they are designed for use in dialog boxes, where the system standardizes their behavior. If an application uses buttons outside dialog boxes, it increases the risk that the application may behave in a nonstandard fashion. Applications typically either use buttons in dialog boxes or use window subclassing to create customized buttons.

Button Types and Styles

There are five kinds of buttons:

  • Push buttons
  • Check boxes
  • Radio buttons
  • Owner-drawn buttons
  • Group boxes

Each type of button has one or more styles. For a table of button styles, see Button Styles.

Button States

This section discusses how selecting a button changes its state and how the application should respond. The section consists of the following topics:

  • Button Selection
  • Elements of a Button State
  • Changes to a Button State

Button Selection

The user can select a button in three ways: by clicking it with the mouse, by tabbing to it and then pressing the ENTER key, or (if the button is part of a group defined by the WS_GROUP style) by tabbing to the selected button in the group and using the arrow keys to move within that group. The two tabbing methods are part of the predefined keyboard interface provided by the system. For a complete description of this interface, see Dialog Boxes.

Selecting a button typically causes the following events:

  • The system gives the button the keyboard focus.
  • The button sends its parent window a message to notify it of the selection.
  • The parent window (or the system) sends the button a message to change its state.
  • The parent window (or the system) repaints the button to reflect its new state.

Elements of a Button State

A button's state can be characterized by its focus state, push state, and check state.

Focus State

The focus state applies to a check box, radio button, push button, or owner-drawn button. A button receives the keyboard focus when the user selects it and loses the focus when the user selects another control. Only one control can have the keyboard focus at a time.

When a button has the keyboard focus, the system typically highlights the text, icon, or bitmap of a button by surrounding it with a dotted line. In addition, a push button has a heavy dark border when it has the focus. The system automatically changes the highlight for an automatic button, but the application must change the highlight for a non-automatic button by sending messages.

Push State

The push state applies to a push button, check box, radio button, or three-state check box, but does not apply to other buttons. The push state of a button can be either pushed or not pushed. When a push button (or any button with the BS_PUSHLIKE style) is pushed, the button is drawn as a sunken button. When it is not pushed, it is drawn as a raised button. When a check box, radio button, or three-state check box is clicked, the background of the button is grayed. When it is not pushed, the background of the button is not grayed.

Check State

The check state applies to a check box, radio button, or three-state check box, but does not apply to other buttons. The state can be checked, cleared, or (for three-state check boxes) indeterminate. A check box is checked when it contains a check mark, and is cleared when it does not. A radio button is checked when it contains a black dot; and is cleared when it does not. A three-state check box is checked when it contains a check mark, is cleared when it does not, and is indeterminate when it contains a grayed box. The system automatically changes the check state of an automatic button, but the application must change the check state of a non-automatic button.

Changes to a Button State

When the user selects a button, it is generally necessary to change one or more of the button's state elements. The system automatically changes the focus state for all button types, the push state for push buttons or buttons with the BS_PUSHLIKE style, and the check state for all automatic buttons. The application must make all other state changes, taking into account the button's type, style, and current state. The following list shows the state elements that must be changed for each button type:

  • A check box must change the check state.
  • A radio button must change the check state. It may also be necessary to change the check state of other radio buttons in the same group to ensure the mutually exclusive nature of radio buttons.
  • Because the state of an owner-drawn button is application dependent, what the application must change in the button can vary. No elements of a group box must be changed, because users cannot select group boxes.

An application can determine a button's state by sending it a BM_GETCHECK or BM_GETSTATE message; the application can set a button's state by sending it a BM_SETCHECK or BM_SETSTATE message.

Notification Messages from Buttons

When the user clicks a button, its state changes, and the button sends notification messages to its parent window. For example, a push button control sends the BN_CLICKED notification message whenever the user chooses the button. In all cases, the low-order word of the wParam parameter contains the control identifier, the high-order word of wParam contains the notification code, and the lParam parameter contains the control window handle.

Both the message and the parent window's response depend on the type, style, and current state of the button. Following are the button notification messages an application should monitor and process.

Message | Description
BN_CLICKED | The user clicked a button.
BN_DBLCLK or BN_DOUBLECLICKED | The user double-clicked a button.
BN_DISABLE | A button is disabled.
BN_PUSHED or BN_HILITE | The user pushed a button.
BN_KILLFOCUS | The button lost the keyboard focus.
BN_PAINT | The button should be painted.
BN_SETFOCUS | The button gained the keyboard focus.
BN_UNPUSHED or BN_UNHILITE | The button is no longer pushed.

A button sends the BN_DISABLE, BN_PUSHED, BN_KILLFOCUS, BN_PAINT, BN_SETFOCUS, and BN_UNPUSHED notification messages only if it has the BS_NOTIFY style. BN_DBLCLK notification messages are sent automatically for BS_USERBUTTON, BS_RADIOBUTTON, and BS_OWNERDRAW buttons. Other button types send BN_DBLCLK only if they have the BS_NOTIFY style. All buttons send the BN_CLICKED notification message regardless of their button styles.

For automatic buttons, the system changes the push state and paints the button. In this case, the application typically processes only the BN_CLICKED and BN_DBLCLK notification messages. For buttons that are not automatic, the application typically responds to the notification message by sending a message to change the state of the button. For information about sending messages to buttons, see Messages to Buttons.

When the user selects an owner-drawn button, the button sends its parent window a WM_DRAWITEM message containing the identifier of the control to be drawn and information about its dimensions and state. For more information about this message, see Using Owner-Drawn Buttons.

Messages to Buttons

A parent window can send messages to a button in an overlapped or child window by using the SendMessage function, or it can send messages to a button in a dialog box by using the SendDlgItemMessage, CheckDlgButton, CheckRadioButton, and IsDlgButtonChecked functions.

An application can use the BM_GETCHECK message to retrieve the check state of check box or radio button. An application can also use the BM_GETSTATE message to retrieve the button's current states (the check state, push state, and focus state). To get information about a specific state, use a bitmask on the returned state value.

The BM_SETCHECK message sets the check state of a check box or radio button; the message returns zero. The BM_SETSTATE message sets the push state of a button; this message also returns zero. The BM_SETSTYLE message changes the style of a button. It is designed for changing button styles within a type (for example, changing a check box to an automatic check box). It is not designed for changing between types (for example, changing a check box to a radio button). An application should not change a button from one type to another.

A button of the BS_BITMAP or BS_ICON style displays a bitmap or icon instead of text. The BM_SETIMAGE message associates a handle to a bitmap or icon with a button. The BM_GETIMAGE message retrieves a handle to the bitmap or icon associated with a button.

An application can also use the DM_GETDEFID message to retrieve the identifier of the default push button control in a dialog box. An application can use the DM_SETDEFID message to set the default push button for a dialog box.

Calling the CheckDlgButton or CheckRadioButton function is equivalent to sending a BM_SETCHECK message. Calling the IsDlgButtonChecked function is equivalent to sending a BM_GETCHECK message.

Button Color Messages

The system provides default color values for buttons. An application can retrieve the default values for these colors by calling the GetSysColor function, or set the values by calling the SetSysColors function. The following table shows the default button-color values.

Value | Element colored
COLOR_BTNFACE | Button faces.
COLOR_BTNHIGHLIGHT | Highlight area (the top and left edges) of a button.
COLOR_BTNSHADOW | Shadow area (the bottom and right edges) of a button.
COLOR_BTNTEXT | Regular (nongrayed) text in buttons.
COLOR_GRAYTEXT | Disabled (gray) text in buttons. This color is set to 0 if the current display driver does not support a solid gray color.
COLOR_WINDOW | Window backgrounds.
COLOR_WINDOWFRAME | Window frames.
COLOR_WINDOWTEXT | Text in windows.

However, calling SetSysColors affects all applications, so you should not call this function to customize buttons for your application.

The system sends a WM_CTLCOLORBTN message to a button's parent window before drawing a button. This message contains a handle to the button's device context and a handle to the child window. The parent window can use these handles to change the button's text and background colors. However, only owner-drawn buttons respond to the parent window processing the message.

Button Default Message Processing

The window procedure for the predefined button control window class carries out default processing for all messages that the button control procedure does not process. When the button control procedure returns FALSE for any message, the predefined window procedure checks the messages and performs the default actions listed in the following table.

Message | Default action
BM_CLICK | Sends the button a WM_LBUTTONDOWN and a WM_LBUTTONUP message, and sends the parent window a BN_CLICKED notification message.
BM_GETCHECK | Returns the check state of the button.
BM_GETIMAGE | Returns a handle to the bitmap or icon associated with the button or NULL if the button has no bitmap or icon.
BM_GETSTATE | Returns the current check state, push state, and focus state of the button.
BM_SETCHECK | Sets the check state for all styles of radio buttons and check boxes. If the wParam parameter is greater than zero for radio buttons, the button is given the WS_TABSTOP style.
BM_SETIMAGE | Associates the specified bitmap or icon handle with the button and returns a handle to the previous bitmap or icon.
BM_SETSTATE | Sets the push state of the button. For owner-drawn buttons, a WM_DRAWITEM message is sent to the parent window if the state of the button has changed.
BM_SETSTYLE | Sets the button style. If the low-order word of the lParam parameter is TRUE, the button is redrawn.
WM_CHAR | Checks a check box or automatic check box when the user presses the plus (+) or equal (=) keys. Clears a check box or automatic check box when the user presses the minus (–) key.
WM_ENABLE | Paints the button.
WM_ERASEBKGND | Erases the background for owner-drawn buttons. The backgrounds of other buttons are erased as part of the WM_PAINT and WM_ENABLE processing.
WM_GETDLGCODE | Returns values indicating the type of input processed by the default button procedure, as shown in the following table.

Button style | Returns
BS_AUTOCHECKBOX | DLGC_WANTCHARS | DLGC_BUTTON
BS_AUTORADIOBUTTON | DLGC_RADIOBUTTON
BS_CHECKBOX | DLGC_WANTCHARS | DLGC_BUTTON
BS_DEFPUSHBUTTON | DLGC_DEFPUSHBUTTON
BS_GROUPBOX | DLGC_STATIC
BS_PUSHBUTTON | DLGC_UNDEFPUSHBUTTON
BS_RADIOBUTTON | DLGC_RADIOBUTTON

Message | Default action
WM_GETFONT | Returns a handle to the current font.
WM_KEYDOWN | Pushes the button if the user presses the SPACEBAR.
WM_KEYUP | Releases the mouse capture for all cases except the TAB key.
WM_KILLFOCUS | Removes the focus rectangle from a button. For push buttons and default push buttons, the focus rectangle is invalidated. If the button has the mouse capture, the capture is released, the button is not clicked, and any push state is removed.
WM_LBUTTONDBLCLK | Sends a BN_DBLCLK notification message to the parent window for radio buttons and owner-drawn buttons. For other buttons, a double-click is processed as a WM_LBUTTONDOWN message.
WM_LBUTTONDOWN | Highlights the button if the position of the mouse cursor is within the button's client rectangle.
WM_LBUTTONUP | Releases the mouse capture if the button had the mouse capture.
WM_MOUSEMOVE | Performs the same action as WM_LBUTTONDOWN, if the button has the mouse capture. Otherwise, no action is performed.
WM_NCCREATE | Turns any BS_OWNERDRAW button into a BS_PUSHBUTTON button.
WM_NCHITTEST | Returns HTTRANSPARENT, if the button control is a group box.
WM_PAINT | Draws the button according to its style and current state.
WM_SETFOCUS | Draws a focus rectangle on the button getting the focus. For radio buttons and automatic radio buttons, the parent window is sent a BN_CLICKED notification message.
WM_SETFONT | Sets a new font and optionally updates the window.
WM_SETTEXT | Sets the text of the button. In the case of a group box, the message paints over the preexisting text before repainting the group box with the new text.
WM_SYSKEYUP | Releases the mouse capture for all cases except the TAB key.

The predefined window procedure passes all other messages to the DefWindowProc function for default processing.


Combo Boxes

A combo box is a unique type of control, defined by the COMBOBOX class, that combines much of the functionality of a list box and an edit control.

This overview describes the types and styles of combo box, the parts of a combo box, the use of an owner-drawn combo box, and how to subclass a combo box. Additional features of combo boxes are also discussed.

The Win32® API provides three types of combo boxes:

  • Simple combo boxes (CBS_SIMPLE)
  • Drop-down combo boxes (CBS_DROPDOWN)
  • Drop-down list boxes (CBS_DROPDOWNLIST)

There are also a number of combo box styles that define specific properties. For example, two styles enable an application to create an owner-drawn combo box, making the application responsible for displaying information in the control.

A combo box consists of a list and a selection field. The list presents the options that a user can select and the selection field displays the current selection. Except in drop-down list boxes, the selection field is an edit control and can be used to enter text not available in the list.

Combo Box Types and Styles

Combo boxes can be characterized by type and style. Combo box types determine whether the combo box list is a drop-down list and whether the selection field is an edit control. A drop-down list appears only when the user opens it, so it uses less screen space than a list that is always visible. If the selection field is an edit control, the user can enter information not available in the list; otherwise, the user can only select items in the list.

The following table shows the three combo box types and indicates their drop-down list and edit control attributes.

Combo box type | Drop-down list | Edit control
Drop-down combo box | Yes | Yes
Drop-down list box | Yes | No
Simple combo box | No | Yes

Combo box styles define specific properties of a combo box. You can combine styles; however some styles only apply to certain combo box types. For a table of combo box styles, see Combo Box Styles.

Combo Box List

A list is the portion of a combo box that displays the items a user can select. Typically, an application initializes the contents of the list when it creates a combo box. Any list item selected by the user is the current selection. In simple and drop-down combo boxes, the user can type in the selection field instead of selecting a list item. In these cases, there is no current selection. For more information, see Current Selection.

List Contents

When an application creates a combo box, it typically initializes the combo box by adding one or more items to the list. Later, an application may add or delete list items, reinitialize the list, or retrieve item information from it.

An application adds list items to a combo box by sending the CB_ADDSTRING message to it. The specified item is added to the end of the list or, in a sorted combo box, in its correct sorted position based on the item's string. In an unsorted combo box, an application can use the CB_INSERTSTRING message to insert an item at a specific position. Once added, a list item is identified by its position.

By using the CB_FINDSTRING or CB_FINDSTRINGEXACT message, an application can determine the position of a list item. CB_FINDSTRING finds an item whose string begins with the specified string. CB_FINDSTRINGEXACT finds an item whose string matches the string exactly. Neither message is case sensitive.

An application can remove a list item by using the CB_DELETESTRING message. If an application needs to reinitialize the combo box list, it can first clear its entire contents by using the CB_RESETCONTENT message. When adding multiple items to the list after a combo box has already been shown, an application can clear the redraw flag to prevent the combo box from being repainted after each item is added. For more information about redrawing, see the description of the WM_SETREDRAW message.

To retrieve the string associated with a list item, an application can use the CB_GETLBTEXT message. The item's string is copied to the buffer specified by the application. To ensure that the buffer is large enough to receive the string, the application can first use the CB_GETLBTEXTLEN message to determine the length of the string. To get the number of list items in a combo box, an application can use the CB_GETCOUNT message.

Current Selection

The current selection is a list item the user has selected; the selected text appears in the selection field of the combo box. However, in the case of a simple combo box or a drop-down combo box, the current selection is only one form of possible user input in a combo box. The user can also type text in the selection field.

The current selection is identified by the zero-based index of the selected list item. An application can set and retrieve it at any time. The parent window or dialog box procedure receives notification when the user changes the current selection for a combo box. The parent window or dialog box is not notified when the application changes the selection.

When a combo box is created, there is no current selection. This is also true for a simple or drop-down combo box, if the user has edited the contents of the selection field. To set the current selection, an application sends the CB_SETCURSEL message to the combo box. An application can also use the CB_SELECTSTRING message to set the current selection to a list item whose string begins with a specified string. To determine the current selection, an application sends the CB_GETCURSEL message to the combo box. If there is no current selection, this message returns CB_ERR.

When the user changes the current selection in a combo box, the parent window or dialog-box procedure receives a WM_COMMAND message with the notification message CBN_SELCHANGE in the high-order word of the wParam parameter. This notification message is not sent when the current selection is set using the CB_SETCURSEL message.

A drop-down combo box or drop-down list box sends the CBN_CLOSEUP notification to the parent window or dialog-box procedure when the drop-down list closes. If the user changed the current selection, the combo box also sends the CBN_SELCHANGE notification when the drop-down list closes. To execute a specific process each time the user selects a list item, you can handle either the CBN_SELCHANGE or CBN_CLOSEUP notification message. Typically, you would wait for the CBN_CLOSEUP notification before processing a change in the current selection. This can be particularly important if a significant amount of processing is required.

An application could also process the notification messages CBN_SELENDOK and CBN_SELENDCANCEL. The system sends CBN_SELENDOK when the user selects a list item, or selects an item and then closes the list. This indicates that the user has finished, and that the selection should be processed. CBN_SELENDCANCEL is sent when the user selects an item, but then selects another control, presses ESC while the drop-down list is open, or closes the dialog box. This indicates that the user's selection should be ignored. CBN_SELENDOK is sent before every CBN_SELCHANGE message.

In a simple combo box, the system sends the CBN_DBLCLK notification message when the user double-clicks a list item. In a drop-down combo box or drop-down list, a single click hides the list, so it is not possible to double-click an item.

Drop-Down Lists

Certain notifications and messages apply only to combo boxes containing drop-down lists. When a drop-down list is open or closed, the parent window of a combo box receives a notification in the form of a WM_COMMAND message. If the list is being opened, the high-order word of wParam is CBN_DROPDOWN. If the list is being closed, it is CBN_CLOSEUP.

An application can open the list of a drop-down combo box or drop-down list box by using the CB_SHOWDROPDOWN message. It can determine whether the list is open by using the CB_GETDROPPEDSTATE message and can determine the coordinates of a drop-down list by using the CB_GETDROPPEDCONTROLRECT message. An application can also increase the width of a drop-down list by using the CB_SETDROPPEDWIDTH message.

Edit Control Selection Fields

The selection field is the portion of a combo box that displays the currently selected list item. In simple and drop-down combo boxes, the selection field is an edit control and can be used to enter text that is not in the list.

An application can retrieve or set the contents of the selection field and can determine or set the edit selection. The application can also limit the amount of text a user can type in the selection field. When the contents of the selection field change, the system sends notification messages to the parent window or dialog box procedure.

To retrieve the content of the selection field, an application can send the WM_GETTEXT message to the combo box. To set the contents of the selection field of a simple or drop-down combo box, an application can send the WM_SETTEXT message to the combo box.

The edit selection is the range of selected text, if any, in the selection field of a simple or drop-down combo box. An application can determine the starting and ending character positions of the current selection by using the CB_GETEDITSEL message. It can also select characters in the edit selection by using the CB_SETEDITSEL message.

Initially, the amount of text that the user can type into the selection field is limited by the size of the selection field. However, if the combo box has the CBS_AUTOHSCROLL style, the text can continue beyond the size of the selection field. An application can use the CB_LIMITTEXT message to limit the amount of text a user can type into the selection field, regardless of whether the control has the CBS_AUTOHSCROLL style.

When the user edits the content of the selection field, the parent window or dialog box procedure receives notification messages. The CBN_EDITUPDATE message is sent first, indicating that the text in the selection field has been edited. After the altered text is displayed, the system sends CBN_EDITCHANGE. When the selection field content changes as the result of a list item being selected, these messages are not sent.

Owner-Drawn Combo Boxes

An application can create an owner-drawn combo box to take responsibility for painting list items. The parent window or dialog box of an owner-drawn combo box (its owner) receives WM_DRAWITEM messages when a portion of the combo box needs to be painted. An owner-drawn combo box can list information other than, or in addition to, text strings. Owner-drawn combo boxes can be of any type. However, the edit control in a simple or drop-down combo box can only display text, while the owner paints the selection field in a drop-down list box.

The owner of an owner-drawn combo box must process the WM_DRAWITEM message. This message is sent whenever a portion of the combo box must be redrawn. The owner may need to process other messages, depending on the styles specified for the combo box.

An application can create an owner-drawn combo box by specifying the CBS_OWNERDRAWFIXED or CBS_OWNERDRAWVARIABLE style. If all list items in the combo box are the same height, such as strings or icons, an application can use the CBS_OWNERDRAWFIXED style. If list items are of varying height, like bitmaps of different size, an application can use the CBS_OWNERDRAWVARIABLE style.

The owner of an owner-drawn combo box can process a WM_MEASUREITEM message to specify the dimensions of list items in the combo box. If the application creates the combo box by using the CBS_OWNERDRAWFIXED style, the system sends the WM_MEASUREITEM message only once. The dimensions specified by the owner are used for all list items. If the CBS_OWNERDRAWVARIABLE style is used, the system sends a WM_MEASUREITEM message for each list item added to the combo box. The owner can determine or set the height of a list item at any time by using the CB_GETITEMHEIGHT and CB_SETITEMHEIGHT messages, respectively.

If the information displayed in an owner-drawn combo box includes text, an application can keep track of the text for each list item by specifying the CBS_HASSTRINGS style. Combo boxes with the CBS_SORT style are sorted based on this text. If a combo box is sorted and not of the CBS_HASSTRINGS style, the owner must process the WM_COMPAREITEM message.

In an owner-drawn combo box, the owner must keep track of list items containing information other than or in addition to text. One convenient way to do this is to save the handle to the information as item data. For more information about item data, see Data Associated with List Items. To free data objects associated with items in a combo box, the owner can process the WM_DELETEITEM message.

For an example of an owner-drawn combo box, see Creating an Owner-Drawn Combo Box.

Subclassed Combo Boxes

Subclassing is a procedure that allows an application to intercept and process messages sent or posted to a window. By using subclassing, an application can substitute its own processing for certain messages, while leaving most message processing to the class-defined window procedure.

When the operating system creates a window, it saves information about it in an internal data structure that includes a pointer to the window procedure. To subclass a window, an application calls the SetClassLong function to replace the pointer to that procedure with a pointer to an application-defined subclass procedure. Thereafter, all messages to the window are sent to the subclass procedure. This procedure then uses the CallWindowProc function to pass unprocessed messages to the original window procedure. For a description of the message processing performed by the COMBOBOX class window procedure, see Default Combo Box Behavior.

When the combo box is outside a dialog box, an application cannot process the TAB, ENTER, and ESC keys unless it uses a subclass procedure. When a simple or drop-down combo box receives the input focus, it immediately sets the focus to its child edit control. Therefore, an application must subclass the edit control to intercept keyboard input for a simple or drop-down combo box. For an example of this, see Subclassing a Combo Box.

If a subclass procedure processes the WM_PAINT message, it must use the BeginPaint function to prepare for painting. Before calling the EndPaint function, it passes the device-context (DC) handle as the wParam parameter for the window procedure. If EndPaint is called first, the class window procedure does no painting because EndPaint validates the entire window.

A technique related to subclassing is superclassing. A superclass resembles any other class except that its window procedure does not call DefWindowProc to handle unprocessed messages. Instead, it passes unprocessed messages to the window procedure for the parent window class. Follow the guidelines in Window Procedures to avoid problems that can occur with subclassing and superclassing.

Special Combo Box Features

The Win32 API provides special-purpose messages and functions that enable an application to display a directory listing in a combo box, associate data with list items in a combo box, and change the keyboard interface for a drop-down combo box or drop-down list box.

Directory Lists

An application can add the names of files or subdirectories to a combo box by sending the CB_DIR message to it. The wParam parameter for this message specifies the attributes of the files to add, and the lParam parameter is a pointer to the text string that defines the file specification.

You can use the DlgDirListComboBox function to replace the contents of a combo box in a dialog box. The function fills the combo box with the names of drives, directories, and files that match a specified set of criteria. The DlgDirSelectComboBoxEx function retrieves the current selection in a combo box initialized by DlgDirListComboBox. These functions make it possible for the user to select a drive, directory, or file from a combo box without typing the location and name of the file.

The DlgDirListComboBox and DlgDirSelectComboBoxEx functions and the CB_DIR message are similar to the DlgDirList and DlgDirSelectEx functions and the LB_DIR message used with list boxes.

Data Associated with List Items

An application can associate data with the list items in a combo box. The CB_SETITEMDATA message associates a DWORD value with a list item, and the CB_GETITEMDATA retrieves the value associated with a list item.

The example in Creating an Owner-Drawn Combo Box uses item data to associate a constant with each item in a drop-down list box. Such a unique value identifies each item independent of its sorted position.

Other applications might use item data to associate a handle or pointer with a list item. If so, an application can process a WM_DELETEITEM message to delete or free the specified object when the list item is deleted

The Extended User Interface

Drop-down combo boxes and drop-down list boxes support an alternative keyboard interface called the extended user interface. By default, the F4 key opens or closes the list, and the DOWN ARROW changes the current selection. In a combo box with the extended user interface, however, the F4 key is disabled and pressing the DOWN ARROW key opens the drop-down list.

To select the user interface for a combo box, an application can send the CB_SETEXTENDEDUI message to the combo box. A TRUE value for the wParam parameter enables the extended user interface; a FALSE value sets the default user interface. To determine whether a combo box uses the extended user interface, an application can send the CB_GETEXTENDEDUI message to the combo box.

Combo Box Notifications

Messages from combo boxes are sent as notifications in the form of WM_COMMAND messages. The notification message is stored in the high word of the wParam parameter, and an application can process the following combo box notification messages.

Notification message | Description
CBN_CLOSEUP | Indicates the list in a drop-down combo box or drop-down list box is about to close.
CBN_DBLCLK | Indicates the user has double-clicked a list item in a simple combo box.
CBN_DROPDOWN | Indicates the list in a drop-down combo box or drop-down list box is about to open.
CBN_EDITCHANGE | Indicates the user has changed the text in the edit control of a simple or drop-down combo box. This notification message is sent after the altered text is displayed.
CBN_EDITUPDATE | Indicates the user has changed the text in the edit control of a simple or drop-down combo box. This notification message is sent before the altered text is displayed.
CBN_ERRSPACE | Indicates the combo box cannot allocate enough memory to carry out a request, such as adding a list item.
CBN_KILLFOCUS | Indicates the combo box is about to lose the input focus.
CBN_SELCHANGE | Indicates the current selection has changed.
CBN_SELENDCANCEL | Indicates that the selection made in the drop down list, while it was dropped down, should be ignored.
CBN_SELENDOK | Indicates that the selection made drop down list, while it was dropped down, should be accepted.
CBN_SETFOCUS | Indicates the combo box has received the input focus.

Default Combo Box Behavior

This following table describes the messages specifically handled by the predefined COMBOBOX class window procedure.

Message | Description
CB_ADDSTRING | Sends an LB_ADDSTRING message to the list window to add a list item.
CB_DELETESTRING | Sends an LB_DELETESTRING message to the list window to delete a list item.
CB_DIR | Adds the file names matching the specified attributes and path to the list.
CB_FINDSTRING | Sends an LB_FINDSTRING message to the list window. This message returns the index of the first list item that begins with the specified text.
CB_FINDSTRINGEXACT | Sends an LB_FINDSTRING message to the list window. This message returns the index of the first list item exactly matching the specified text.
CB_GETCOUNT | Sends an LB_GETCOUNT message to the list window. It returns the number of list items.
CB_GETCURSEL | Sends an LB_GETCURSEL message to the list window. It returns the index of the currently selected item, if any.
CB_GETDROPPEDCONTROLRECT | Fills the specified rectangle structure with the screen coordinates of a drop-down list.
CB_GETDROPPEDSTATE | Returns TRUE if a drop-down list is open; otherwise, it returns FALSE.
CB_GETDROPPEDWIDTH | Returns the minimum allowable width, in pixels, of the drop-down list.
CB_GETEDITSEL | Sends an EM_GETSEL message to the edit control, and it returns the starting and ending position of the current selection. In drop-down list boxes, the window procedure returns CB_ERR.
CB_GETEXTENDEDUI | Returns TRUE if the combo box is a drop-down combo box or drop-down list box and the extend user-interface flag is set; otherwise, it returns FALSE.
CB_GETHORIZONTALEXTENT | Sends an LB_GETHORIZONTALEXTENT message to the list window. It returns the scrollable width, in pixels, of the drop-down list.
CB_GETITEMDATA | Sends an LB_GETITEMDATA message to the list window. It returns the value associated with the specified list item.
CB_GETITEMHEIGHT | Sends an LB_GETITEMHEIGHT message to the list window. It returns the height, in pixels, of the specified owner-drawn list item.
CB_GETLBTEXT | Sends an LB_GETTEXT message to the list window. It copies the specified list text to the specified buffer.
CB_GETLBTEXTLEN | Sends an LB_GETTEXTLEN message to the list window. It returns the length, in TCHARs, of the specified list text.
CB_GETLOCALE | Sends an LB_GETLOCALE message to the list window. It returns the current locale for the list.
CB_GETTOPINDEX | Sends an LB_GETTOPINDEX message to the list window. It returns the index of the first visible item in the drop-down list.
CB_INITSTORAGE | Sends an LB_INITSTORAGE message to the list window. It initializes space for the specified number of items and the specified number of bytes for item strings.
CB_INSERTSTRING | Sends an LB_INSERTSTRING message to the list window. It inserts a list item at the specified position.
CB_LIMITTEXT | Sends an EM_LIMITTEXT message to the edit control. It sets the maximum number of characters a user can enter in the edit control. In drop-down list boxes, the window procedure returns CB_ERR.
CB_RESETCONTENT | Sends an LB_RESETCONTENT message to the list window, and it removes the contents of the list.
CB_SELECTSTRING | Sends an LB_SELECTSTRING message to the list window. It selects the first list item, if any, that begins with the characters in the specified text.
CB_SETCURSEL | Sends an LB_SETCURSEL message to the list window, and it sets the current selection.
CB_SETDROPPEDWIDTH | Sets the minimum allowable width, in pixels, of the drop down list.
CB_SETEDITSEL | Sends an EM_SETSEL message to the edit control. It selects the specified range of text. In drop-down list boxes, the window procedure returns CB_ERR.
CB_SETEXTENDEDUI | Sets or clears the extended user-interface flag. This flag changes the keys that open and close the list in a drop-down combo box or drop-down list box. If the combo box is a simple combo box, the window procedure returns CB_ERR.
CB_SETHORIZONTALEXTENT | Sends an LB_SETHORIZONTALEXTENT message to the list window. It sets the scrollable width, in pixels, of the drop down list.
CB_SETITEMDATA | Sends an LB_SETITEMDATA message to the list window. It associates the specified value with a list item.
CB_SETITEMHEIGHT | Sends an LB_SETITEMHEIGHT message to the list window. It sets the height of the specified owner-drawn list item or the selection field.
CB_SETLOCALE | Sends an LB_SETLOCALE message to the list window, and it sets the current locale for the list. The locale affects how the list is sorted if it has the CBS_SORT style and strings are added using CB_ADDSTRING.
CB_SETTOPINDEX | Sends an LB_SETTOPINDEX message to the list window. It scrolls the drop-down list so the specified item is at the top of the visible range.
CB_SHOWDROPDOWN | Shows or hides the drop-down list. This message has no effect on simple combo boxes.
WM_CHAR | Processes character input. In drop-down list boxes, this message is passed to the list window, which moves the selection to the first item beginning with the specified character. In simple and drop-down combo boxes, this message is passed to the edit control.
WM_CLEAR | Deletes the edit selection. In simple and drop-down combo boxes, the edit control processes this message. In drop-down list boxes, the window procedure returns CB_ERR.
WM_COMMAND | Processes notification messages from the edit control and list window and sends corresponding combo box notification messages to the parent window.
 | For edit control notifications, the window procedure may update the list window's current selection, caret index, and top index. For list notification messages, the window procedure may update the content of the selection field.
WM_COMPAREITEM | Passes the message to the parent window, enabling the application to specify the relative sort position of two owner-drawn list items. The combo box window receives this message from the list window.
WM_COPY | Copies the edit selection to the clipboard. In simple and drop-down combo boxes, the edit control processes this message. In drop-down list boxes, the window procedure returns CB_ERR.
WM_CREATE | Initializes the combo box.
WM_CUT | Deletes the edit selection and places it on the clipboard. In simple and drop-down combo boxes, the edit control processes this message. In drop-down list boxes, the window procedure returns CB_ERR.
WM_DELETEITEM | Passes the message to the parent window, notifying the application that a list item has been deleted. The combo box window receives this message from the list window.
WM_DRAWITEM | Passes the message on to the parent window enabling the application to paint the specified list item. The combo box window receives this message from the list window. The window procedure can also originate this message to have the application paint the selection field of a drop-down list box.
WM_ENABLE | Sets the state to enable or prohibit mouse and keyboard input.
WM_ERASEBKGND | Returns 1, indicating that the background is erased.
WM_GETDLGCODE | Returns a combination of the DLG_WANTCHARS and DLGC_WANTARROWS values.
WM_GETFONT | Returns the handle to the current font with which the combo box will draw its text.
WM_GETTEXT | Copies the contents of the selection field to the specified buffer. In simple and drop-down combo boxes, the edit control processes this message.
WM_GETTEXTLENGTH | Returns the length, in characters, of the text in the selection field. In simple and drop-down combo boxes, the edit control processes this message.
WM_KEYDOWN | Processes noncharacter keyboard input. In drop-down list boxes, this message is sent to the list window, which may show or hide itself, or change its current selection or caret index. In simple and drop-down combo boxes, this message is passed to the edit control. The edit control passes certain keys to the list window, such as the UP and DOWN ARROW keys and the F4 key.
WM_KILLFOCUS | Hides the highlight in the selection field and closes the drop-down list, if necessary. If the window receiving the input focus is part of the combo box (for example, the edit control), this message is ignored.
WM_LBUTTONDBLCLK | Same as WM_LBUTTONDOWN.
WM_LBUTTONDOWN | Sets the focus to the combo box and, for drop-down combo boxes and drop-down lists, can open or close the list. If it opens the list, the window procedure captures the mouse to enable selection by dragging and releasing the mouse button.
WM_LBUTTONUP | Releases the mouse capture if the mouse opened the list.
WM_MEASUREITEM | Posts the message to the parent window, enabling the application to modify the contents of the specified MEASUREITEMSTRUCT structure. The combo box window receives this message from the list window.
WM_MOUSEMOVE | Posts the message to the list window if the mouse has opened the list and the mouse button is still down. This enables a user to select an item by dragging the mouse pointer to a list item and then releasing the button.
WM_NCCREATE | Allocates an internal data structure used by the combo box window procedure.
WM_NCDESTROY | Frees resources allocated in response to the WM_NCCREATE message.
WM_PAINT | Paints the invalid region of the combo box. If wParam is not NULL, it is assumed to be a DC handle passed from a subclass function. The window procedure uses the specified DC instead of calling BeginPaint and EndPaint.
WM_PASTE | Replaces the edit selection with the contents of the clipboard. In simple and drop-down combo boxes, the edit control processes this message. In drop-down list boxes, the window procedure returns CB_ERR.
WM_SETFOCUS | Sets the focus to the edit control or, in drop-down list boxes, inverts the selection field and turns on the caret in the list window.
WM_SETFONT | Saves the specified font handle in an internal structure, adjusts the dimensions of the selection field and list, and invalidates the combo box window. Text in the selection field and the list is displayed in the saved font.
WM_SETREDRAW | Sets or clears the redraw flag. If the redraw flag is cleared, the combo box is not repainted until the flag is set again.
WM_SETTEXT | Sets the contents of the edit control. In simple and drop-down combo boxes, the edit control processes this message. In drop-down list boxes, the window procedure returns CB_ERR.
WM_SIZE | Resizes the child windows, if necessary.
WM_SYSKEYDOWN | Opens or closes the drop-down list depending on which arrow key the user pressed.

All other messages are passed to the DefWindowProc function for default processing.


ComboBoxEx Controls

ComboBoxEx Controls are an extension of the combo box control that provides native support for item images. To make item images easily accessible, the control provides image list support. By using this control, you can provide the functionality of a combo box without having to manually draw item graphics.

About ComboBoxEx Controls

Effectively, a ComboBoxEx control creates a child combo box and performs owner draw tasks for you based on an assigned image list. Therefore, the CBS_OWNERDRAWFIXED style is implied and you need not use it when creating the control. Because image lists are used to provide item graphics, the CBS_OWNERDRAWVARIABLE style cannot be used.

A ComboBoxEx control must be initialized by calling the InitCommonControlsEx function, specifying ICC_USEREX_CLASSES in the accompanying INITCOMMONCONTROLSEX structure.

You can create a ComboBoxEx control by using the CreateWindowEx function and specifying WC_COMBOBOXEX as the window class. The class is registered when the InitCommonControlsEx function is called as explained above.

ComboBoxEx controls are created without a default image list. To use item images, you must create an image list for the ComboBoxEx control and assign it to the control using the CBEM_SETIMAGELIST message. If you do not assign an image list to the ComboBoxEx control, the control displays item text only.

ComboBoxEx Control Styles

ComboBoxEx controls support only the following ComboBox styles:

  • CBS_SIMPLE
  • CBS_DROPDOWN
  • CBS_DROPDOWNLIST
  • WS_CHILD

There are also several ComboBoxEx Control Extended Styles that are used only by ComboBoxEx.

Note The CBS_SIMPLE style may not work properly in some cases.

Because the ComboBoxEx control performs owner draw tasks for you based on an assigned image list, the CBS_OWNERDRAWFIXED style is implied; you need not use it when creating the control. Because image lists are used to provide item graphics, the CBS_OWNERDRAWVARIABLE style cannot be used. The ComboBoxEx control also supports ComboBoxEx Control Extended Styles that provide additional features.

ComboBoxEx Control Items

ComboBoxEx controls maintain item information using a COMBOBOXEXITEM structure. This structure includes members for item indexes, image indexes (normal, selection state, and overlay), indentation values, text strings, and item-specific values.

The ComboBoxEx control provides easy access to and manipulation of items through messaging. To add or delete an item, send the CBEM_INSERTITEM or CBEM_DELETEITEM message. You can modify items currently in the control using the CBEM_SETITEM message.

Callback Items

ComboBoxEx controls support callback item attributes. You can specify an item as a callback item when you add it to the control using CBEM_INSERTITEM. When you assign values to an item's COMBOBOXEXITEM structure, you must specify the appropriate callback flag values. The following are COMBOBOXEXITEM structure members and their corresponding callback flag values.

Member | Callback value
pszText | LPSTR_TEXTCALLBACK
iImage | I_IMAGECALLBACK
iSelectedImage | I_IMAGECALLBACK
iOverlay | I_IMAGECALLBACK
iIndent | I_INDENTCALLBACK

The control will request information about callback items by sending CBEN_GETDISPINFO notification messages. This notification is sent in the form of a WM_NOTIFY message. When your application processes this message, it must provide the requested information for the control. If you set the mask member of the accompanying COMBOBOXEXITEM structure to CBEIF_DI_SETITEM, the control will store the item data and will not request it again.

ComboBoxEx Control Image Lists

If you want a ComboBoxEx control to display icons with items, you must provide an image list. ComboBoxEx controls support up to three images for an item—one for its selected state, one for its nonselected state, and one for an overlay image. Assign an existing image list to a ComboBoxEx control using the CBEM_SETIMAGELIST message.

The COMBOBOXEXITEM structure contains members that represent the image indexes for each image list (selected, unselected, and overlay). For each item, set these members to display the desired images. It is not necessary to specify image indexes for each type of image. You can mix and match image types as you like, but always set the mask member of the COMBOBOXEXITEM structure to indicate which members are being used. The control ignores members that have not been flagged as valid.

Note If you use the CBS_SIMPLE style, icons are not displayed.

About ComboBoxEx Control Notification Messages

A ComboBoxEx control sends notification messages to report changes within itself or to request callback item information. The parent of the control receives all WM_COMMAND messages from the combo box contained within the ComboBoxEx control. The ComboBoxEx control sends its own notifications using WM_NOTIFY messages. As a result, the control's owner must be prepared to process both forms of notification messages.

Following are the ComboBoxEx-specific notification messages.

Notification | Description
CBEN_BEGINEDIT | Signals that the user has activated the drop-down list or clicked in the control's edit box.
CBEN_ENDEDIT | Signals that the user has selected an item from the drop-down list or has concluded an edit operation within the edit box.
CBEN_DELETEITEM | Reports that an item was deleted.
CBEN_GETDISPINFO | Requests information about an item's attributes.
CBEN_INSERTITEM | Signals that an item was inserted in the control.

ComboBoxEx Control Message Forwarding

The following are the standard combo box messages that a ComboBoxEx control forwards to its child combo box. Some of these messages may be processed by the ComboBoxEx control either before or after the message has been forwarded.

  • CB_DELETESTRING
  • CB_FINDSTRINGEXACT
  • CB_GETCOUNT
  • CB_GETCURSEL
  • CB_GETDROPPEDCONTROLRECT
  • CB_GETDROPPEDSTATE
  • CB_GETITEMDATA
  • CB_GETITEMHEIGHT
  • CB_GETLBTEXT
  • CB_GETLBTEXTLEN
  • CB_GETEXTENDEDUI
  • CB_LIMITTEXT
  • CB_RESETCONTENT
  • CB_SETCURSEL
  • CB_SETDROPPEDWIDTH
  • CB_SETEXTENDEDUI
  • CB_SETITEMDATA
  • CB_SETITEMHEIGHT
  • CB_SHOWDROPDOWN

Following are the windows messages that a ComboBoxEx control forwards to its parent window:

  • WM_COMMAND (This includes all of the CBN_ notifications.)
  • WM_NOTIFY

Using ComboBoxEx Controls

This section contains sample code and information about the following topics related to ComboBoxEx controls:

  • Creating a ComboBoxEx Control
  • Preparing ComboBoxEx Items and Images
  • Supporting Callback Items
  • Processing ComboBoxEx Notifications

Creating a ComboBoxEx Control

To create a ComboBoxEx control, call the CreateWindowEx function, using WC_COMBOBOXEX as the window class. You must first register the window class by calling the InitCommonControlsEx function, while specifying the ICC_USEREX_CLASSES bit in the accompanying INITCOMMONCONTROLSEX structure.

The following application-defined function creates a ComboBoxEx control with the CBS_DROPDOWN style in the main window.

// CreateComboEx - Registers the ComboBoxEx window class and creates
// a ComboBoxEx control in the client area of the main window.
//
// g_hwndMain - A handle to the main window.
// g_hinst    - A handle to the program instance.

HWND WINAPI CreateComboEx(void)
{
    HWND hwnd;
    INITCOMMONCONTROLSEX icex;

    icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
    icex.dwICC = ICC_USEREX_CLASSES;

    InitCommonControlsEx(&icex);

    hwnd = CreateWindowEx(0, WC_COMBOBOXEX, NULL,
                    WS_BORDER | WS_VISIBLE |
                    WS_CHILD | CBS_DROPDOWN,
                    // No size yet--resize after setting image list.
                    0,      // Vertical position of Combobox
                    0,      // Horizontal position of Combobox
                    0,      // Sets the width of Combobox
                    100,    // Sets the height of Combobox
                    g_hwndMain,
                    NULL,
                    g_hinst,
                    NULL);

    return (hwnd);
}

Preparing ComboBoxEx Items and Images

To add an item to a ComboBoxEx control, first define a COMBOBOXEXITEM structure. Set the mask member of the structure to indicate which members you want the control to use. Set the specified members of the structure to the values you want, and then send the CBEM_INSERTITEM message to add the item to the control.

The following application-defined function adds 15 items to an existing ComboBoxEx control. Note that the mask member of the COMBOBOXEXITEM structure includes flag values that tell the control to display images for each item.

#define MAX_ITEMS 15

// AddItems - Uses the CBEM_INSERTITEM message to add items to an
// existing ComboBoxEx control.

BOOL WINAPI AddItems(HWND hwndCB)
{
    //  Declare and init locals.
    COMBOBOXEXITEM cbei;
    int iCnt;

    typedef struct {
        int iImage;
        int iSelectedImage;
        int iIndent;
        LPTSTR pszText;
    } ITEMINFO, *PITEMINFO;

    ITEMINFO IInf[ ] = {
        { 0, 3,  0, "first"},
        { 1, 4,  1, "second"},
        { 2, 5,  2, "third"},
        { 0, 3,  0, "fourth"},
        { 1, 4,  1, "fifth"},
        { 2, 5,  2, "sixth"},
        { 0, 3,  0, "seventh"},
        { 1, 4,  1, "eighth"},
        { 2, 5,  2, "ninth"},
        { 0, 3,  0, "tenth"},
        { 1, 4,  1, "eleventh"},
        { 2, 5,  2, "twelfth"},
        { 0, 3,  0, "thirteenth"},
        { 1, 4,  1, "fourteenth"},
        { 2, 5,  2, "fifteenth"}
    };

    // Set the mask common to all items.
    cbei.mask = CBEIF_TEXT | CBEIF_INDENT |
                CBEIF_IMAGE| CBEIF_SELECTEDIMAGE;

    for(iCnt=0;iCnt<MAX_ITEMS;iCnt++){
        // Initialize the COMBOBOXEXITEM struct.
        cbei.iItem          = iCnt;
        cbei.pszText        = IInf[iCnt].pszText;
        cbei.cchTextMax     = sizeof(IInf[iCnt].pszText);
        cbei.iImage         = IInf[iCnt].iImage;
        cbei.iSelectedImage = IInf[iCnt].iSelectedImage;
        cbei.iIndent        = IInf[iCnt].iIndent;

        // Tell the ComboBoxEx to add the item. Return FALSE if
        // this fails.
        if(SendMessage(hwndCB,CBEM_INSERTITEM,0,(LPARAM)&cbei) == -1)
            return FALSE;
    }

    // Assign the existing image list to the ComboBoxEx control
    // and return TRUE.
    SendMessage(hwndCB,CBEM_SETIMAGELIST,0,(LPARAM)g_himl);

    // Set size of control to make sure it's displayed correctly now
    // that the image list is set.
    SetWindowPos(hwndCB,NULL,20,20,250,120,SWP_NOACTIVATE);

    return TRUE;
}

Supporting Callback Items

If your application is going to use callback items in a ComboBoxEx control, it must be prepared to handle the CBEN_GETDISPINFO notification message. A ComboBoxEx control sends this notification whenever it needs the owner to provide specific item information. For more information about callback items, see Callback Items.

The following application-defined function processes CBEN_GETDISPINFO by providing attributes for a given item. Note that it sets the mask member of the incoming COMBOBOXEXITEM structure to CBEIF_DI_SETITEM. Setting mask to this value makes the control retain the item information so it will not need to request the information again.

Show Example

// DoItemCallback - Processes CBEN_GETDISPINFO by providing item
// attributes for a given callback item.

void WINAPI DoItemCallback(PNMCOMBOBOXEX pNMCBex)
{
    DWORD dwMask = pNMCBex->ceItem.mask;

    if(dwMask & CBEIF_TEXT)
        ;// Provide item text.

    if(dwMask & CBEIF_IMAGE)
        ;// Provide an item image index.

    /*
     * Provide other callback information as desired.
     */

    // Make the ComboBoxEx control hold onto the item information.
    pNMCBex->ceItem.mask = CBEIF_DI_SETITEM;
}

Processing ComboBoxEx Notifications

A ComboBoxEx control notifies its parent window of events by sending WM_NOTIFY messages. Because the control uses a child combo box, it forwards all WM_COMMAND notification messages it receives to the parent window to be processed. Therefore, your application must be prepared to process WM_NOTIFY messages from the ComboBoxEx and WM_COMMAND messages forwarded from the ComboBoxEx child combo box control.

The example in this section handles the WM_NOTIFY and WM_COMMAND messages from a ComboBoxEx control by calling a corresponding application-defined function to process them.

LRESULT CALLBACK WndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch(msg){

        case WM_COMMAND:
            // If this is an "old style" combo box notification, handle it.
            if((HWND)lParam == g_hwndCB)
                DoOldNotify(hwnd,  wParam);
            break;

        case WM_NOTIFY:
            return (DoCBEXNotify(hwnd, lParam));

        case WM_PAINT:
            hdc = BeginPaint(hwnd, &ps);
            EndPaint(hwnd, &ps);
            break;

        case WM_DESTROY:
            PostQuitMessage(0);
            break;

        default:
            return DefWindowProc(hwnd, msg, wParam, lParam);
            break;
    }

    return FALSE;
}


Date and Time Picker Controls

A date and time picker (DTP) control provides a simple and intuitive interface through which to exchange date and time information with a user. For example, with a DTP control you can ask the user to enter a date and then retrieve his or her selection with ease.

About Date and Time Picker Controls

Date and time picker controls are implemented in version 4.70 and later of Comctl32.dll. To create a DTP control call CreateWindowEx and specify DATETIMEPICK_CLASS as the window class. The class is registered when the date and time picker class is loaded from the common control dynamic-link library (DLL). Register this class by calling the InitCommonControlsEx function, while specifying the ICC_DATE_CLASSES bit flag in the accompanying INITCOMMONCONTROLSEX structure.

Note

  • Windows does not support dates prior to 1601. See the FILETIME structure for details.
  • The DTP control is based on the Gregorian calendar, which was introduced in 1753. It will not calculate dates that are consistent with the Julian calendar that was in use prior to 1753.

Date and Time Picker User Interface

The client area of a date and time picker (DTP) control displays date and time information and acts as the interface through which users modify the information. The control's display consists of fields that are defined by the control's Format Strings. Additionally, the control will display a check box when the DTS_SHOWNONE style is in use.

Each field in the control displays a portion of the date and time information that the control stores internally. The user can click a field to set keyboard focus and then provide keyboard input to change the information represented by that field. The DTP control automatically updates internal information based on the user's input. The control recognizes the following as valid input.

Input Category | Description
Arrow Keys | The control accepts arrow keys to navigate the fields in the control and change values. The user can press the or keys to move through the control. If the user attempts to move past the last field in a given direction, the keyboard focus "wraps around" to the field on the opposite side of the control. The and keys change values in the current field incrementally.
End and Home | The control accepts the VK_END and VK_HOME virtual keys to change the value within the current field to its upper and lower limits, respectively.
Function Keys | The key activates edit mode. The key causes the control to display a drop-down month calendar control (pressing does this as well).
Numbers | The control accepts numeric input in two-character segments. If the value entered by the user is invalid (like setting the month to 14), the control rejects it and resets the display to the previous value.
Plus and Minus | The control accepts the VK_ADD and VK_SUBTRACT virtual keys from the numeric keypad to increment and decrement the value in the current field.

DTP controls that do not use the DTS_UPDOWN style display an arrow button. If the user clicks this button, a month calendar control drops down. The user can select a specific date by clicking an area of the calendar.

Date and Time Picker Control Styles and Formats

Date and time picker (DTP) controls have several Date and Time Picker Control Styles that determine a control's appearance and behavior. Specify the style when creating the control with the dwStyle parameter of CreateWindowEx. To retrieve or change the window style after you have created the control, use GetWindowLong and SetWindowLong .

Preset Formats

There are three preset formats available for displaying the date and one for displaying time. Set these formats by choosing one of the following window styles:

DTS_LONGDATEFORMAT | The display will look like: "Friday, April 19, 1996".
DTS_SHORTDATEFORMAT | The display will look like: "4/19/96".
DTS_SHORTDATECENTURYFORMAT | Version 5.80. The display will look like: "4/19/1996".
DTS_TIMEFORMAT | The display will look like: "5:31:42 PM".

Custom formats

A DTP control relies on a format string to determine how it will display fields of information. If the preset formats are not sufficient, you can create a custom format by defining your own format string. Custom formats provide greater flexibility for an application. They enable you to specify the order in which the control will display fields of information. You can include body text as well as callback fields for requesting information from the user. Once the string is created, you assign it to the DTP control with a DTM_SETFORMAT message.

Format Strings

A DTP format string consists of a series of elements that represent a particular piece of information and define its display format. The elements will be displayed in the order they appear in the format string.

Date and time format elements will be replaced by the actual date and time. They are defined by the following groups of characters:

Element | Description
"d" | The one- or two-digit day.
"dd" | The two-digit day. Single-digit day values are preceded by a zero.
"ddd" | The three-character weekday abbreviation.
"dddd" | The full weekday name.
"h" | The one- or two-digit hour in 12-hour format.
"hh" | The two-digit hour in 12-hour format. Single-digit values are preceded by a zero.
"H" | The one- or two-digit hour in 24-hour format.
"HH" | The two-digit hour in 24-hour format. Single-digit values are preceded by a zero.
"m" | The one- or two-digit minute.
"mm" | The two-digit minute. Single-digit values are preceded by a zero.
"M" | The one- or two-digit month number.
"MM" | The two-digit month number. Single-digit values are preceded by a zero.
"MMM" | The three-character month abbreviation.
"MMMM" | The full month name.
"t" | The one-letter AM/PM abbreviation (that is, AM is displayed as "A").
"tt" | The two-letter AM/PM abbreviation (that is, AM is displayed as "AM").
"yy" | The last two digits of the year (that is, 1996 would be displayed as "96").
"yyyy" | The full year (that is, 1996 would be displayed as "1996").

To make the information more readable, you can add body text to the format string by enclosing it in single quotes. Spaces and punctuation marks do not need to be quoted.

Note Nonformat characters that are not delimited by single quotes will result in unpredictable display by the DTP control.

For example, to display the current date with the format "'Today is: 04:22:31 Tuesday Mar 23, 1996", the format string is "'Today is: 'hh':'m':'s dddd MMM dd', 'yyyy". To include a single quote in your body text, use two consecutive single quotes. For example, "'Don''t forget' MMM dd',' yyyy" produces output that looks like: Don't forget Mar 23, 1996. It is not necessary to use quotes with the comma, so "'Don''t forget' MMM dd, yyyy" is also valid, and produces the same output.

Callback fields

In addition to the standard Format Strings and body text, you can also define certain parts of the display as Callback fields. These fields can be used to query the user for information. To declare a callback field, include one or more "X" characters (ASCII Code 88) anywhere in the format string. You can create callback fields that have a unique identity by repeating the "X" character. Thus, the format string "XX dddd MMM dd', 'yyy XXX" contains two unique callback fields, "XX" and "XXX". Like other DTP control fields, callback fields are displayed in left-to-right order based on their location in the format string.

When the DTP control parses the format string and encounters a callback field, it sends DTN_FORMAT and DTN_FORMATQUERY notification messages. The format string element corresponding to the callback field is included with the notifications to allow the receiving application to determine which callback field is being queried. The owner of the control must respond to these notifications to ensure that the custom information is properly displayed.

Date and Time Picker Control Notification Messages

A date and time picker (DTP) control sends notification messages when it receives user input or processes and reacts to callback fields. The parent of the control receives these notification messages in the form of WM_NOTIFY messages.

The following notification messages are used with DTP controls.

Notification | Description
DTN_CLOSEUP | Indicates that the drop-down month calendar is about to be removed.
DTN_DATETIMECHANGE | Signals a change within the DTP control.
DTN_DROPDOWN | Indicates that the drop-down month calendar is about to be displayed.
DTN_FORMAT | Requests text to display in a portion of the format string described as a callback field.
DTN_FORMATQUERY | Requests information about the maximum allowable size of the text to be displayed in a callback field.
DTN_USERSTRING | Signals the end of a user's edit operation within the control. This notification is sent only by DTP controls that use the DTS_APPCANPARSE style.
DTN_WMKEYDOWN | Signals that the user has pressed a key in a callback field of the DTP control.

Creating a Date and Time Picker Control

To create a date and time picker (DTP) control, use the CreateWindowEx function, specifying DATETIMEPICK_CLASS as the window class. You must first register the window class by calling the InitCommonControlsEx function, while specifying the ICC_DATE_CLASSES bit in the accompanying INITCOMMONCONTROLSEX structure.

The following example creates a DTP control in an existing modeless dialog box. It uses the DTS_SHOWNONE style to enable the user to simulate deactivation of the date within the control.

//  CreateDatePick creates a DTP control within a dialog box.
//  Returns the handle to the new DTP control if successful, or NULL
//  otherwise.
//
//    hwndMain - The handle to the main window.
//    g_hinst  - global handle to the program instance.

HWND WINAPI CreateDatePick(hwndMain)
{
    HWND hwndDP = NULL;
    HWND hwndDlg = NULL;
    INITCOMMONCONTROLSEX icex;

    icex.dwSize = sizeof(icex);
    icex.dwICC = ICC_DATE_CLASSES;

    InitCommonControlsEx(&icex);

    hwndDlg = CreateDialog  (g_hinst,
                             MAKEINTRESOURCE(IDD_DIALOG1),
                             hwndMain,
                             DlgProc);

    if(hwnDlg)
        hwndDP = CreateWindowEx(0,
                             DATETIMEPICK_CLASS,
                             "DateTime",
                             WS_BORDER|WS_CHILD|WS_VISIBLE|DTS_SHOWNONE,
                             20,50,220,20,
                             hwndDlg,
                             NULL,
                             g_hinst,
                             NULL);

    return (hwndDP);
}

Processing Date and Time Picker Notifications

The following example processes the DTN_DATETIMECHANGE, DTN_FORMAT, DTN_FORMATQUERY, and DTN_WMKEYDOWN notifications by calling the DoDateTimeChange, DoFormatQuery, DoFormat, and DoWMKeydown application-defined functions.

Other topics in this chapter provide additional information on these notifications. See Supporting Callback Fields and Processing the DTN_DATETIMECHANGE Notification Message for additional information.

BOOL WINAPI DoNotify(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
    LPNMHDR hdr = (LPNMHDR)lParam;

    switch(hdr->code){

        case DTN_DATETIMECHANGE:{
            LPNMDATETIMECHANGE lpChange = (LPNMDATETIMECHANGE)lParam;
            DoDateTimeChange(lpChange);
        }
        break;

        case DTN_FORMATQUERY:{
            LPNMDATETIMEFORMATQUERY lpDTFQuery = (LPNMDATETIMEFORMATQUERY)lParam;

            // Process DTN_FORMATQUERY to ensure that the control
            // displays callback information properly.
            DoFormatQuery(hdr->hwndFrom, lpDTFQuery);
        }
        break;

        case DTN_FORMAT:{
            LPNMDATETIMEFORMAT lpNMFormat = (LPNMDATETIMEFORMAT) lParam;

            // Process DTN_FORMAT to supply information about callback
            // fields (fields) in the DTP control.
            DoFormat(hdr->hwndFrom, lpNMFormat);
        }
        break;

        case DTN_WMKEYDOWN:{
            LPNMDATETIMEWMKEYDOWN lpDTKeystroke =
                            (LPNMDATETIMEWMKEYDOWN)lParam;

            // Process DTN_WMKEYDOWN to respond to a user's keystroke in
            // a callback field.
            DoWMKeydown(hdr->hwndFrom, lpDTKeystroke);
        }
        break;
    }

    // All of the above notifications require the owner to return zero.
    return FALSE;
}

Processing the DTN_DATETIMECHANGE Notification

A date and time picker (DTP) control sends the DTN_DATETIMECHANGE message whenever a change occurs. This message will be generated if the user changes one of the fields in the control or changes the state of the control's check box (DTS_SHOWNONE only).

The following example is an application-defined function designed to update a static control within a dialog box. The text within the static control is changed to reflect the current state of the DTP control.

void WINAPI DoDateTimeChange(LPNMDATETIMECHANGE lpChange)
{
    // If the user has unchecked the DTP's check box, change the
    // text in a static control to show the appropriate message.
    //
    // g_hwndDlg - a program-global address of a dialog box.

    if(lpChange->dwFlags == GDT_NONE)
        SetDlgItemText(g_hwndDlg, IDC_STATUS, "Disabled");
    else
        SetDlgItemText(g_hwndDlg, IDC_STATUS, "Active");
}

Supporting Callback Fields in a DTP control

If you plan to use callback fields with the date and time picker (DTP) controls in your application, you must be prepared to handle DTN_FORMATQUERY, DTN_FORMAT, and DTN_WMKEYDOWN notification messages. For additional information about callback fields, see Callback fields.

This section contains information about how your application can process these notification messages. There are several examples of source code for application-defined functions. The following list shows notification messages with sample functions that process them.

Notification Message | Sample Function
DTN_FORMATQUERY | DoFormatQuery
DTN_FORMAT | DoFormat
DTN_WMKEYDOWN | DoWMKeydown

The DoFormatQuery application-defined function

A date and time picker (DTP) control sends a DTN_FORMATQUERY notification message to request information about the maximum possible size of a callback field within the control. Handling this message ensures that all fields are displayed properly. The following DoFormatQuery application-defined function processes the DTN_FORMATQUERY notification message by calculating the width of the widest possible string for a given callback field.

//  DoFormatQuery processes DTN_FORMATQUERY messages to ensure that the
//  DTP control displays callback fields properly.
//

void WINAPI DoFormatQuery(
 HWND hwndDP,
 LPNMDATETIMEFORMATQUERY lpDTFQuery)
{
    HDC hdc;
    HFONT hFont, hOrigFont;

    //  Prepare the device context for GetTextExtentPoint32 call.
    hdc = GetDC(hwndDP);

    hFont = FORWARD_WM_GETFONT(hwndDP, SendMessage);

    if(!hFont)
        hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);

    hOrigFont = SelectObject(hdc, hFont);

    // Check to see if this is the callback segment desired. If so,
    // use the longest text segment to determine the maximum
    // width of the callback field, and then place the information into
    // the NMDATETIMEFORMATQUERY structure.
    if(!lstrcmp("XX",lpDTFQuery->pszFormat))
        GetTextExtentPoint32 (hdc,
                          "366",  // widest date string
                          3,
                          &lpDTFQuery->szMax);

    // Reset the font in the device context; then release the context.
    SelectObject(hdc,hOrigFont);
    ReleaseDC(hwndDP, hdc);
}

The DoFormat application-defined function

A date and time picker (DTP) control sends the DTN_FORMAT notification to request text that will be displayed in a callback field of the control. By handling this notification message, you allow the DTP control to display information that it does not natively support.

The following DoFormat application-defined function processes DTN_FORMAT notification messages by providing a text string for a callback field. DoFormat calls the GetDayNum application-defined function to request the day number to be used in the callback string.

//  DoFormat processes DTN_FORMAT to provide the text for a callback
//  field in a DTP control. In this example, the callback field
//  contains a value for the day of year. The function calls the
//  application-defined function GetDayNum (below) to retrieve
//  the correct value. StringCchPrintf truncates the formatted string if
//  the entire string will not fit into the destination buffer.

void WINAPI DoFormat(HWND hwndDP, LPNMDATETIMEFORMAT lpDTFormat)
{
HRESULT hr = StringCchPrintf(lpDTFormat->szDisplay,
                sizeof(lpDTFormat->szDisplay)/sizeof(lpDTFormat->szDisplay[0]),
                "%d",GetDayNum(&lpDTFormat->st));
if(SUCCEEDED(hr))
{
// TODO: Write code to handle the case when the function succeeds.
}
else
{
// TODO: Write code to handle the case when the function fails or the string
// is truncated.
}

The GetDayNum application-defined function

The application-defined sample function DoFormat calls the following GetDayNum application-defined function to request the day number based on the current date. GetDayNum returns an INT value that represents the current day of the year, from 0 to 366. This function calls another application-defined function, IsLeapYr, during processing.

//  GetDayNum is an application-defined function that retrieves the
//  correct day of year value based on the contents of a given
//  SYSTEMTIME structure. This function calls the IsLeapYr function to
//  check if the current year is a leap year. The function returns an
//  integer value that represents the day of year.

int WINAPI GetDayNum(SYSTEMTIME *st)
{
    int iNormYearAccum[ ] = {31,59,90,120,151,181,
                            212,243,273,304,334,365};
    int iLeapYearAccum[ ] = {31,60,91,121,152,182,
                            213,244,274,305,335,366};
    int iDayNum;

    if(IsLeapYr(st->wYear))
        iDayNum=iLeapYearAccum[st->wMonth-2]+st->wDay;
    else
        iDayNum=iNormYearAccum[st->wMonth-2]+st->wDay;

    return (iDayNum);
}

The IsLeapYr application-defined function

The application-defined sample function GetDayNum calls the IsLeapYr function to determine whether the current year is a leap year. IsLeapYr returns a BOOL value that is TRUE if it is a leap year and FALSE otherwise.

//  IsLeapYr determines if a given year value is a leap year. The
//  function returns TRUE if the current year is a leap year, and
//  FALSE otherwise.

BOOL WINAPI IsLeapYr(int iYear)
{
    int iQuotient;
    BOOL fLeapYr = FALSE;

    // If the year is evenly divisible by 4 and not by 100, then this
    // is a leap year.
    if(!(iYear%4) && (iYear%100))
        fLeapYr = TRUE;
    else{
        // If the year is evenly divisible by 4 and 100, then check to
        // see if the quotient of year divided by 100 is also evenly
        // divisible by 4. If it is, then this is a leap year.
        if(!(iYear%4) && !(iYear%100)){
            iQuotient = iYear/100;
            if(!(iQuotient%4)) fLeapYr = TRUE;
        }
    }

    return (fLeapYr);
}

The DoWMKeydown application-defined function

Date and time picker (DTP) controls send the DTN_WMKEYDOWN message to report that the user has typed input in a callback field. Handling this message allows you to emulate the same keyboard responses supported for standard DTP fields or provide custom responses. The following DoWMKeydown application-defined function provides an example of how DTN_WMKEYDOWN notifications can be handled.

//  DoWMKeydown increments or decrements the day of month according
//  to user keyboard input.

void WINAPI DoWMKeydown(
 HWND hwndDP,
 LPNMDATETIMEWMKEYDOWN lpDTKeystroke)
{
    int delta =1;
    if(!lstrcmp(lpDTKeystroke->pszFormat,"XX")){
        switch(lpDTKeystroke->nVirtKey){
            case VK_DOWN:
            case VK_SUBTRACT:
                delta = -1;  // fall through

            case VK_UP:
            case VK_ADD:
                lpDTKeystroke->st.wDay += delta;
                break;
        }
    }
}


Edit Controls

An edit control is a rectangular control window typically used in a dialog box to permit the user to enter and edit text by typing on the keyboard.

Edit controls support both the Unicode character set in which characters are two bytes, and ANSI character sets in which characters are one byte. For more information about Unicode and ANSI character sets, see Unicode and Character Sets.

The Win32 API also provides support for rich edit controls, which support many features not available in system edit controls. For more information, see Rich Edit Controls.

About Edit Controls

An edit control is selected and receives the input focus when a user clicks the mouse inside it or presses the TAB key. After it is selected, the edit control displays its text (if any) and a flashing caret that indicates the insertion point. The user can then enter text, move the insertion point, or select text to be edited by using the keyboard or the mouse. An edit control can send notification messages to its parent window in the form of WM_COMMAND messages. For more information about messages from an edit control, see Edit Control Notification Messages. A parent window can send messages to an edit control in a dialog box by calling the SendDlgItemMessage function. Each of the messages sent to edit controls are discussed in this overview.

The system provides both single-line edit controls (sometimes called SLEs) and multiline edit controls (sometimes called MLEs). Edit controls belong to the EDIT window class.

A combo box is a control that combines much of the functionality of an edit control and a list box. In a combo box, the edit control displays the current selection and the list box presents options a user can select. For more information about combo boxes, see Combo Boxes.

Many developers use the dialog boxes provided in the common dialog box library (Comdlg32.dll) to perform tasks that otherwise might require customized edit controls. For information about common dialog boxes, see Common Dialog Box Library.

Edit Control Types and Styles

There are several edit control styles. An individual edit control can have several styles at the same time. If an application creates an edit control using the CreateWindow or CreateWindowEx function, however, it must specify these edit control styles. For a table of edit control styles, see Edit Control Styles.

Every edit control specifies a combination of style values that define the appearance and features of the edit control. The style values can establish the appearance of a single-line or multiline edit control; align the text in the control; and determine how, and even if, text appears in the edit control. The number and type of styles the application uses depend on the type and purpose of the edit control.

There are two line styles for edit controls. The default is a single-line edit control that doesn't require an associated style. An application can also create a multiline edit control by using the ES_MULTILINE style.

There are three styles that cause the system to align the text in an edit control. The ES_LEFT, ES_CENTER, and ES_RIGHT styles determine whether text is aligned on the left, center, or right, respectively.

An application can use a style to determine how the system displays text that a user enters into an edit control. The ES_LOWERCASE style converts the text into lowercase characters; the ES_UPPERCASE style converts the text into uppercase characters. Some applications may need to convert the text in a string (such as a file name) into a specific character set. The ES_OEMCONVERT style ensures the proper conversion of characters in these instances. For more information about character sets, see Consoles and Character-Mode Support.

When the amount of text to be displayed exceeds the size of the edit control, an application can use two styles to scroll the text through the edit control. The ES_AUTOHSCROLL style automatically scrolls text horizontally in single-line and multiline edit controls. When the application has a multiline edit control, it can also use the ES_AUTOVSCROLL style to automatically scroll text vertically, if necessary.

Other available styles define different aspects of an edit control. The ES_NUMBER style restricts input to digits only in the edit control. The ES_NOHIDESEL style specifies that the selected text is not hidden when the edit control loses the keyboard focus. The ES_READONLY style makes the edit control read-only. The ES_PASSWORD style displays all characters in a single-line edit control as asterisks. An application can define a different character to display by using the EM_SETPASSWORDCHAR message, as described later in this topic. In multiline edit controls, an application can specify the ES_WANTRETURN style to request that the system insert a carriage return when the user presses the ENTER key in the edit control. For information on wordwrap and line breaks, see Handling Wordwrap and Line Breaks.

By default, an edit control has no border. To give it one, an application can use the WS_BORDER window style.

The Text Buffer

The system stores edit control text in a buffer and copies it to the control, as necessary. The following topics discuss how the system allocates and initializes the buffer and changes its characteristics:

Allocating a Text Buffer

When the system creates an edit control, it automatically creates a text buffer, sets its initial size, and increases the size as necessary. The size can be up to a predefined limit of approximately 32 KB for single-line edit controls. Because this limit can change, it is called a soft limit. An application can set a hard limit to the buffer size by sending an EM_SETLIMITTEXT message to the edit control. If the buffer exceeds either limit, the system sends the application an EN_ERRSPACE message. An application can retrieve the current text limit by sending an EM_GETLIMITTEXT message.

The system typically creates an edit control buffer in a dialog box, using memory outside the application's data segment. An application can suppress this default allocation behavior and create the buffer from its local heap by using the DS_LOCALEDIT style when creating the edit control. An application that uses the DS_LOCALEDIT style is responsible for all buffer allocations. To make the initial allocation, an application can call the LocalAlloc function and pass the returned buffer handle to the edit control by sending it an EM_SETHANDLE message. To make subsequent allocations (in response to an EN_ERRSPACE message, for example), an application should save the current buffer content (if necessary) and obtain a new buffer as follows.

To save the current buffer and obtain a new one

  1. Retrieve the handle of the memory currently allocated for the text in a multiline edit control by sending the control an EM_GETHANDLE message.
  2. Free the buffer by calling the LocalFree function.
  3. Obtain a new buffer (and buffer handle) by calling LocalAlloc.
  4. Give the buffer handle to the system by sending the control an EM_SETHANDLE message.

The EM_SETHANDLE and EM_GETHANDLE messages apply only to multiline edit controls.

An application that uses the default allocation behavior (that is, does not use the DS_LOCALEDIT style) must not send EM_SETHANDLE and EM_GETHANDLE messages to the edit control.

Sending an EM_SETHANDLE message has several side effects: it clears the undo flag (making the EM_CANUNDO message return zero), it clears the modify flag (making the EM_GETMODIFY message return zero), and it redraws the edit control window.

Initializing a Text Buffer

An application can initialize or reinitialize an edit control's text buffer by calling the SetDlgItemText function. An application can retrieve the content of a text buffer by calling the GetDlgItemText function

Making a Text Buffer Read-only

For each edit control, the system maintains a read-only flag that indicates whether the control's text is read-write (the default) or read-only. An application can set the read-write flag or the read-only flag for the text by sending the control an EM_SETREADONLY message. To determine whether an edit control is read-only, an application can call the GetWindowLong function using the GWL_STYLE constant. The EM_SETREADONLY message applies to both single-line and multiline edit controls.

Changing the Formatting Rectangle

The visibility of an edit control's text is governed by the dimensions of its window rectangle and its formatting rectangle. The window rectangle is the client area of the window containing the edit control. The formatting rectangle is a construct maintained by the system for formatting the text displayed in the window rectangle. When an edit control is first displayed, the two rectangles are identical on the screen. An application can make the formatting rectangle larger than the window rectangle (thereby limiting the visibility of the edit control's text) or smaller than the window rectangle (thereby creating extra white space around the text).

An application can set the coordinates of an edit control's formatting rectangle by sending it an EM_SETRECT message. The EM_SETRECT message also automatically redraws the edit control's text. To establish the coordinates of the formatting rectangle without redrawing the control's text, an application can send the control an EM_SETRECTNP message. To retrieve the coordinates of the formatting rectangle, an application can send the control an EM_GETRECT message. These messages apply to multiline edit controls only.

Text Operations

The system automatically processes all user-initiated text operations and notifies the application when the operations are completed.

  • Selecting an Edit Control
  • Selecting Text
  • Replacing Text
  • Changing the Font Used By an Edit Control
  • Cut, Copy, Paste, and Clear Operations
  • Modifying Text
  • Limiting User-Entered Text
  • Character and Line Operations
  • Scrolling Text in an Edit Control
  • Setting Tab Stops and Margins
  • Concealing User Input
  • Using Integers
  • Undoing Text Operations
  • Handling Wordwrap and Line Breaks
  • Retrieving Points and Characters
  • Auto complete
  • Complex Scripts in Edit Controls

Selecting an Edit Control

The user can select an edit control by clicking it with the mouse or by pressing the TAB key to move to it. The tabbing method is part of a predefined keyboard interface that the system provides. For a complete description of this interface, see Dialog Boxes. When the user selects an edit control, the system gives the control the keyboard focus and highlights its text by using reverse video.

Selecting Text

After selecting an edit control, the user can select text in the control by using the mouse or the keyboard. An application can retrieve the starting and ending character positions of the current selection in an edit control by sending the control an EM_GETSEL message. The return value for the ending position is one greater than the last character in the selection (that is, the position of the first character following the last selected character).

An application can also select text in an edit control by sending the control an EM_SETSEL message with the starting and ending character indexes for the selection. For example, the application can use EM_SETSEL with EM_REPLACESEL to delete text from an edit control.

These three messages apply to both single-line and multiline edit controls.

Replacing Text

An application can replace selected text in an edit control by sending the control an EM_REPLACESEL message with a pointer to the replacement text. If there is no current selection, EM_REPLACESEL inserts the replacement text at the insertion point. The application may receive an EN_ERRSPACE notification message if the replacement text exceeds the available memory. This message applies to both single-line and multiline edit controls.

An application can use EM_REPLACESEL to replace part of an edit control's text or the SetDlgItemText function to replace all of it.

Changing the Font Used By an Edit Control

An application can change the font that an edit control uses by sending the WM_SETFONT message. Most applications do this while processing the WM_INITDIALOG message. Changing the font does not change the size of the edit control; applications that send the WM_SETFONT message may have to retrieve the font metrics for the text and recalculate the size of the edit control. For more information about fonts and font metrics, see Fonts and Text.

Cut, Copy, Paste, and Clear Operations

The Win32 API provides four messages for moving text between an edit control and the clipboard. The WM_COPY message copies the current selection (if any) from an edit control to the clipboard without deleting it from the edit control. The WM_CUT message deletes the current selection (if any) in the edit control and copies the deleted text to the clipboard. The WM_CLEAR message deletes the current selection (if any) from an edit control, but does not copy it to the clipboard (unless the user pressed the SHIFT key). The WM_PASTE message copies text from the clipboard into an edit control at the insertion point. These four messages apply to both single-line and multiline edit controls.

With Microsoft® Windows NT® version 4.0 or later, an edit control includes a built-in context menu that makes it easy for the user to move text between the edit control and the clipboard. The context menu appears when the user right-clicks the control. The commands in the context menu include Undo, Cut, Copy, Paste, Delete, and Select All.

Modifying Text

The user can select, delete, or move text in an edit control. The system maintains an internal flag for each edit control indicating whether the content of the control has been modified. The system clears this flag when it creates the control and sets the flag whenever the text in the control is modified. An application can retrieve the modification flag by sending the control an EM_GETMODIFY message. The application can then set or clear the modification flag by sending the control an EM_SETMODIFY message. These messages apply to both single-line and multiline edit controls.

Limiting User-Entered Text

The default limit to the amount of text a user can enter in an edit control is 32 KB. An application can change the default limit by sending the control an EM_SETLIMITTEXT message. This message sets a hard limit to the number of bytes the user can enter into an edit control, but affects neither text that is already in the control when the message was sent nor text copied to the control by the SetDlgItemText function or the WM_SETTEXT message. For example, suppose that the application uses the SetDlgItemText function to place 500 bytes in an edit control, and the user also enters 500 bytes (1,000 bytes total). If the application then sends an EM_SETLIMITTEXT message limiting user-entered text to 300 bytes, the 1,000 bytes already in the edit control remain there, and the user cannot add any more text. On the other hand, if the application sends an EM_SETLIMITTEXT message limiting user-entered text to 1,300 bytes, the 1,000 bytes remain, but the user can add 300 more bytes.

When the user reaches the character limit of an edit control, the system sends the application a WM_COMMAND message containing an EN_MAXTEXT notification message. This notification message does not mean that memory has been exhausted, but that the limit for user-entered text has been reached; the user cannot enter any more text. To change this limit, an application must send the control a new EM_SETLIMITTEXT message with a higher limit.

As an example of the use of EM_SETLIMITTEXT and EN_MAXTEXT, suppose that the application must limit the user to no more than four characters in an edit control. The application would use EM_SETLIMITTEXT to specify a four-character limit. If the user tried to enter a fifth character, the system would send an EN_MAXTEXT notification message to the application.

Character and Line Operations

The Win32 API provides several messages that return information about the characters and lines in an edit control. Most of the messages return an index, usually a zero-based number, to refer to a character or line. Given this, a single-line edit control containing n characters, the line index is zero and the characters are indexed from zero to n-1. In a multiline edit control containing m lines and n characters, the lines are indexed from zero to m-1, and the characters are indexed from zero to n-1. Note that character indexing ignores line breaks.

An application can determine the number of characters in an edit control by sending the WM_GETTEXTLENGTH message to the edit control. This message returns the length, in characters (not including the terminating null character), of the text in a single-line or multiline edit control. The EM_LINELENGTH message returns the length, in characters, of a line specified by the character index of a character in the line. The returned length does not include any selected characters. An application can use these messages in a single-line or multiline edit control.

The EM_GETFIRSTVISIBLELINE message returns the zero-based index of the uppermost visible line in a multiline edit control, or the zero-based index of the first visible character in a single-line edit control. An application can copy a line from an edit control to a buffer by sending the EM_GETLINE message to the edit control. The line is specified by its line index and the first word of the receiving buffer contains the maximum number of bytes to be copied to the buffer. The return value is the number of bytes copied. This message can also be used in a single-line or multiline edit control.

There are unique messages available to return the information about a line in a multiline edit control. The EM_GETLINECOUNT message returns the number of lines in an edit control. The EM_LINEFROMCHAR message returns the index of the line containing a specified character index. The EM_LINEINDEX message returns the index of the first character in a specified line.

Scrolling Text in an Edit Control

To implement scrolling in an edit control, you can use the automatic scrolling styles discussed in Edit Control Types and Styles, or you can explicitly add scroll bars to the edit control. To add a horizontal scroll bar, use the style WS_HSCROLL; to add a vertical scroll bar, use the style WS_VSCROLL. An edit control with scroll bars processes its own scroll bar messages. For detailed information about adding scroll bars to edit controls, see Scroll Bars.

The system provides three messages that an application can send to an edit control with scroll bars. The EM_LINESCROLL message can scroll a multiline edit control both vertically and horizontally. The lParam parameter specifies the number of lines to scroll vertically starting from the current line and the wParam parameter specifies the number of characters to scroll horizontally, starting from the current character. The edit control doesn't acknowledge horizontal scrolling messages if it has the ES_CENTER or ES_RIGHT style. The EM_LINESCROLL message applies to multiline edit controls only.

The EM_SCROLL message scrolls a multiline edit control vertically. The wParam parameter specifies the scrolling action. The EM_SCROLL message applies to multiline edit controls only. EM_SCROLL has the same effect as the WM_VSCROLL message.

The EM_SCROLLCARET message scrolls the caret into view in an edit control. This was done in 16-bit Microsoft® Windows® by specifying wParam = FALSE in an EM_SETSEL message. A Win32-based application should use the EM_SCROLLCARET message for the task.

Setting Tab Stops and Margins

An application can set tab stops in a multiline edit control by using the EM_SETTABSTOPS message. (The default for a tab stop is eight characters.) When an application adds text to the edit control, tab characters in the text automatically generate space up to the next tab stop. The EM_SETTABSTOPS message does not automatically cause the system to redraw the text. To do that, an application can call the InvalidateRect function. The EM_SETTABSTOPS message applies to multiline edit controls only.

An application can set the width of the left and right margins for an edit control by using the EM_SETMARGINS message. After sending this message, the system redraws the edit control to reflect the new margin settings. An application can retrieve the width of the left or right margin by sending the EM_GETMARGINS message. By default, the edit control margins are set just wide enough to accommodate the largest character horizontal overhang (negative ABC widths) for the current font being used in the edit control.

Concealing User Input

An application can use a password character in an edit control to conceal user input. When a password character is set, it is displayed in place of each character the user types. When a password character is removed, the control displays the characters the user types. If the application creates a single-line edit control using the style ES_PASSWORD, the default password character is an asterisk (*). An application can use the EM_SETPASSWORDCHAR message to remove or define a different password character and the EM_GETPASSWORDCHAR message to retrieve the current password character. These messages apply to single-line edit controls only.

Using Integers

The Win32 API provides two integer-conversion functions for edit controls designed to contain numbers only. The SetDlgItemInt function creates the string representation of a specified integer (signed or unsigned) and sends the string to an edit control. SetDlgItemInt returns no value. The GetDlgItemInt function creates an integer (signed or unsigned) from its string representation in an edit control. GetDlgItemInt returns the integer (or an error value).

Undoing Text Operations

Every edit control maintains an undo flag that indicates whether an application can reverse or undo the most recent operation on the edit control (undoing a text deletion, for example). The edit control sets the undo flag to indicate that the operation can be undone and resets it to indicate that the operation cannot be undone. An application can determine the setting of the undo flag by sending the control an EM_CANUNDO message.

An application can undo the most recent operation by sending the control an EM_UNDO message. An operation can be undone provided no other edit control operation occurs first. For example, the user can delete text, replace the text (undo the deletion), and then delete the text again (undo the replacement). The EM_UNDO message applies to both single-line and multiline edit controls and always works for single-line edit controls.

An application can reset an edit control's undo flag by sending the control an EM_EMPTYUNDOBUFFER message. The system automatically resets the undo flag whenever an edit control receives an EM_SETHANDLE or WM_SETTEXT message. The SetDlgItemText function sends a WM_SETTEXT message.

Handling Wordwrap and Line Breaks

An application can use wordwrap functions with multiline edit controls to locate the word or word fragment that should be wrapped to the next line. Using the default wordwrap function provided by the system, lines always end at the spaces between words. An application can specify its own wordwrap function by supplying a EditWordBreakProc wordwrap function and sending the edit control an EM_SETWORDBREAKPROC message. An application can retrieve the address of the current wordwrap function by sending the control an EM_GETWORDBREAKPROC message.

An application may direct a multiline edit control to add or remove a soft line break character (two carriage returns and a line feed) automatically at the end of wrapped-text lines. An application can turn this feature on or off by sending the edit control an EM_FMTLINES message. This message applies only to multiline edit controls and does not affect a line that ends with a hard line break (one carriage return and a line feed entered by the user). Also in multiline edit controls, an application can specify the ES_WANTRETURN style to request that the system insert a carriage return when the user presses the ENTER key in the edit control.

Retrieving Points and Characters

To determine the character closest to a specified point in the client area of an edit control, send the EM_CHARFROMPOS message to the control. The message returns the character index and line index of the character nearest the point. Similarly, you can retrieve the client area coordinates of a specified character by sending the EM_POSFROMCHAR message. The message returns the x and y coordinates of the upper-left corner of the specified character.

Autocompletion of Strings

Autocompletion expands strings that have been partially entered in an edit control into complete strings. For example, when a user starts to enter a URL in the Address edit control that is embedded in the Microsoft® Internet Explorer toolbar, autocompletion expands the string into one or more complete URLs that are consistent with the existing partial string. A partial URL string such as "mic" might be expanded to "http://www.microsoft.com" or "http://www.microsoft.com/windows". Autocompletion is typically used with edit controls or with controls that have an embedded edit control.

For more information, see the IAutoComplete and IAutoComplete2 interface documentation.

Complex Scripts in Edit Controls

A complex script is a language whose printed form is not laid out in a simple way. For example, a complex script may allow bidirectional rendering, contextual shaping of glyphs, or combining characters. The standard edit controls have been extended to support multilingual text and complex scripts. This includes not only input and display, but also correct cursor movement over character clusters (in Thai and Devanagari script, for example).

A well-written application will receive this support automatically, without modification. Again, you should consider adding support for right-to-left reading order and right alignment. In this case, toggle the extended style flags of the edit control window to control these attributes, as shown in the following example:

// ID_EDITCONTROL is the control ID in the resource file.
HANDLE hWndEdit = GetDlgItem(hDlg, ID_EDITCONTROL);
LONG lAlign = GetWindowLong(hWndEdit, GWL_EXSTYLE) ;
// To toggle alignment
lAlign ^= WS_EX_RIGHT ;
// To toggle reading order

lAlign ^= WS_EX_RTLREADING ;

After setting the lAlign value, enable the new display by setting the extended style of the edit control window as follows:

// This assumes your edit control is in a dialog box. If not,
// get the edit control handle from another source.
SetWindowLong(hWndEdit, GWL_EXSTYLE, lAlign);
InvalidateRect(hWndEdit, NULL, FALSE);

Beginning in Windows 2000, the standard edit control supports a context menu that allows the user to toggle the reading order and insert/display Unicode bidirectional control characters.

Uniscribe is another set of functions that provide fine control for processing complex scripts.


Image Lists

An image list is a collection of images of the same size, each of which can be referred to by its index. Image lists are used to efficiently manage large sets of icons or bitmaps. All images in an image list are contained in a single, wide bitmap in screen device format. An image list can also include a monochrome bitmap that contains masks used to draw images transparently (icon style).

Using Image Lists

The Microsoft® Win32® application programming interface (API) provides image list functions that enable you to create and destroy image lists, add and remove images, replace and merge images, draw images, and drag images.

To use the image list functions, include the common control header file in your source code files and link with the common control export library. In addition, before calling any image list function, use the InitCommonControls function to ensure that the common control dynamic-link library (DLL) is loaded.

Types

There are two types of image lists: nonmasked and masked. A nonmasked image list consists of a color bitmap that contains one or more images. A masked image list consists of two bitmaps of equal size. The first is a color bitmap that contains the images, and the second is a monochrome bitmap that contains a series of masks—one for each image in the first bitmap.

When a nonmasked image is drawn, it is simply copied into the target device context; that is, it is drawn over the existing background color of the device context. When a masked image is drawn, the bits of the image are combined with the bits of the mask, typically producing transparent areas in the bitmap where the background color of the target device context shows through. There are several drawing styles that you can specify when drawing a masked image. For example, you can specify that the image be dithered to indicate a selected object.

Creating and Destroying Image Lists

You create an image list by calling the ImageList_Create function. The parameters include the type of image list to create, the dimensions of each image, and the number of images you intend to add to the list. For a nonmasked image list, the function creates a single bitmap large enough to hold the specified number of images of the given dimensions. Then it creates a screen-compatible device context and selects the bitmap into it. For a masked image list, the function creates two bitmaps and two screen-compatible device contexts. It selects the image bitmap into one device context and the mask bitmap into the other. The common control DLL contains the executable code for the image list functions.

In ImageList_Create, you specify the initial number of images that will be in an image list as well as the number of images by which the list can grow. So if you attempt to add more images than you initially specified, the image list automatically grows to accommodate the new images.

If ImageList_Create succeeds, it returns a handle to the HIMAGELIST type. You use this handle in other image list functions to access the image list and manage the images. You can add and remove images, copy images from one image list to another, and merge images from two different image lists. When you no longer need an image list, you can destroy it by specifying its handle in a call to the ImageList_Destroy function.

The following example creates a masked image list and uses the ImageList_AddIcon function to add two icons to the list.

// AddIconsToImageList - creates a masked image list and adds some
// icons to it.
// Returns the handle to the new image list.
// hinst - handle to the application instance.
//
// Global variables and constants
//     g_nBird and g_nTree - indexes of the images.
//     cx_icon and cy_icon - width and height of the icon.
//     num_icons - number of icons to add to the image list.
extern int g_nBird, g_nTree;

#define CX_ICON  32
#define CY_ICON  32
#define NUM_ICONS 3

HIMAGELIST AddIconsToImageList(HINSTANCE hinst)
{
    HIMAGELIST himlIcons;  // handle to new image list
    HICON hicon;           // handle to icon

    // Ensure that the common control DLL is loaded.
    InitCommonControls();

    // Create a masked image list large enough to hold the icons.
    himlIcons = ImageList_Create(CX_ICON, CY_ICON, ILC_MASK, NUM_ICONS, 0);

    // Load the icon resources, and add the icons to the image list.
    hicon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_BIRD));
    g_nBird = ImageList_AddIcon(himlIcons, hicon);

    hicon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_TREE));
    g_nTree = ImageList_AddIcon(himlIcons, hicon);

    return himlIcons;
}

Adding and Removing Images

You can add bitmapped images, icons, or cursors to an image list. You add bitmapped images by specifying the handles to two bitmaps in a call to the ImageList_Add function. The first bitmap contains one or more images to add to the image bitmap, and the second bitmap contains the masks to add to the mask bitmap. For nonmasked image lists, the second bitmap handle is ignored; it can be set to NULL.

The ImageList_AddMasked function also adds bitmapped images to a masked image list. This function is similar to ImageList_Add, except that you do not specify a mask bitmap. Instead, you specify a color that the system combines with the image bitmap to automatically generate the masks. Each pixel of the specified color in the image bitmap is changed to black, and the corresponding bit in the mask is set to 1. As a result, any pixel in the image that matches the specified color is transparent when the image is drawn.

The ImageList_AddIcon function adds an icon or cursor to an image list. If the image list is masked, ImageList_AddIcon adds the mask provided with the icon or cursor to the mask bitmap. If the image list is nonmasked, the mask for the icon or cursor is not used when drawing the image.

You can create an icon based on an image and mask in an image list by using the ImageList_GetIcon function. The function returns the handle to the new icon.

ImageList_Add, ImageList_AddMasked, and ImageList_AddIcon assign an index to each image as it is added to an image list. The indexes are zero-based; that is, the first image in the list has an index of zero, the next has an index of one, and so on. After adding a single image, the functions return the index of the image. When more than one image is added at a time, the functions return the index of the first image.

The ImageList_Remove function removes an image from an image list.

Replacing and Merging Images

The ImageList_Replace and ImageList_ReplaceIcon functions replace an image in an image list with a new image. ImageList_Replace replaces an image with a bitmapped image and mask, and ImageList_ReplaceIcon replaces an image with an icon or cursor.

The ImageList_Merge function merges two images, storing the new image in a new image list. The new image is created by drawing the second image transparently over the first. The mask for the new image is the result of performing a logical OR operation on the bits of the masks for the two existing images.

Drawing Images

To draw an image, you use the ImageList_Draw or ImageList_DrawEx function. You specify the handle to an image list, the index of the image to draw, the handle to the destination device context, a location within the device context, and one or more drawing styles.

When you specify the ILD_TRANSPARENT style, ImageList_Draw or ImageList_DrawEx uses a two-step process to draw a masked image. First, it performs a logical AND operation on the bits of the image and the bits of the mask. Then it performs a logical XOR operation on the results of the first operation and the background bits of the destination device context. This process creates transparent areas in the resulting image; that is, each white bit in the mask causes the corresponding bit in the resulting image to be transparent.

Before drawing a masked image on a solid color background, you should use the ImageList_SetBkColor function to set the background color of the image list to the same color as the destination. Setting the color eliminates the need to create transparent areas in the image and enables ImageList_Draw or ImageList_DrawEx to simply copy the image to the destination device context, resulting in a significant increase in performance. To draw the image, specify the ILD_NORMAL style in a call to ImageList_Draw or ImageList_DrawEx.

You can set the background color for a masked image list at any time so that it draws correctly on any solid background. Setting the background color to CLR_NONE causes images to be drawn transparently by default. To retrieve the background color of an image list, use the ImageList_GetBkColor function.

The ILD_BLEND25 and ILD_BLEND50 styles dither the image with the system highlight color. These styles are useful if you use a masked image to represent an object that the user can select. For example, you can use the ILD_BLEND50 style to draw the image when the user selects it.

A nonmasked image is copied to the destination device context using the SRCCOPY raster operation. The colors in the image appear the same regardless of the background color of the device context. The drawing styles specified in ImageList_Draw or ImageList_DrawEx also have no effect on the appearance of a nonmasked image.

Drawing the image

The following function draws an image and saves the client coordinates of the image's bounding rectangle. A subsequent function uses the bounding rectangle to determine whether the user has clicked the image.

// DrawTheImage - draws an image transparently and saves
// the bounding rectangle of the drawn image.
// Returns TRUE if successful, or FALSE otherwise.
// hwnd - handle to the window in which to draw the image.
// himl - handle to the image list that contains the image.
// cx and cy - client coordinates for the upper-left corner of the image.
//
// Global variables and constants
//     g_nImage - index of the image to draw.
//     g_rcImage - bounding rectangle of the image.
//     CX_IMAGE and CY_IMAGE - width and height of the image.
extern int g_nImage;
extern RECT g_rcImage;

#define CX_IMAGE 32
#define CY_IMAGE 32

BOOL DrawTheImage(HWND hwnd, HIMAGELIST himl, int cx, int cy)
{
    HDC hdc;

    if ((hdc = GetDC(hwnd)) == NULL)
        return FALSE;
    if (!ImageList_Draw(himl, g_nImage, hdc, cx, cy, ILD_TRANSPARENT))
        return FALSE;
    ReleaseDC(hwnd, hdc);

    SetRect(&g_rcImage, cx, cy, CX_IMAGE + cx, CY_IMAGE + cy);

    return TRUE;
}

Dragging Images

The Win32 API includes functions for dragging an image on the screen. The dragging functions move an image smoothly, in color, and without any flashing of the cursor. Both masked and unmasked images can be dragged.

The ImageList_BeginDrag function begins a drag operation. The parameters include the handle to the image list, the index of the image to drag, and the location of the hot spot within the image. The hot spot is a single pixel that the dragging functions recognize as the exact screen location of the image. Typically, an application sets the hot spot so that it coincides with the hot spot of the mouse cursor. The ImageList_DragMove function moves the image to a new location.

The ImageList_DragEnter function sets the initial position of the drag image within a window and draws the image at the position. The parameters include the handle to the window in which to draw the image and the coordinates of the initial position within the window. The coordinates are relative to the window's upper-left corner, not the client area. The same is true for all of the image dragging functions that take coordinates as parameters. This means you must compensate for the widths of window elements such as the border, title bar, and menu bar when specifying the coordinates. If you specify a NULL window handle when calling ImageList_DragEnter, the dragging functions draw the image in the device context associated with the desktop window, and the coordinates are relative to the upper-left corner of the screen.

ImageList_DragEnter locks all other updates to the given window during the drag operation. If you need to do any drawing during a drag operation, such as highlighting the target of the operation, you can temporarily hide the dragged image by using the ImageList_DragLeave function. Another method is to use the GetDCEx function with the DCX_LOCKWINDOWUPDATE value to retrieve a device context that allows you to draw. Be careful, however, not to obliterate the dragged image.

The ImageList_SetDragCursorImage function creates a new drag image by combining the given image (typically a mouse cursor image) with the current drag image. Because the dragging functions use the new image during a drag operation, you should use the ShowCursor function to hide the actual mouse cursor after calling ImageList_SetDragCursorImage. Otherwise, the system may appear to have two mouse cursors for the duration of the drag operation.

When an application calls ImageList_BeginDrag, the system creates a temporary, internal image list and then copies the specified drag image to the internal list. You can retrieve the handle to the temporary drag image list by using the ImageList_GetDragImage function. The function also retrieves the current drag position and the offset of the drag image relative to the drag position.

Beginning the drag operation

The following function is intended to be called in response to a mouse button-down message, such as WM_LBUTTONDOWN . The function determines whether the user has clicked within the bounding rectangle of the image. If the user has clicked, the function captures the mouse input, erases the image from the client area, and calculates the position for the hot spot within the image. The function sets the hot spot to coincide with the hot spot of the mouse cursor. Then the function begins the drag operation by calling ImageList_BeginDrag.

// StartDragging - begins dragging a bitmap.
// Returns TRUE if successful, or FALSE otherwise.
// hwnd - handle to the window in which the bitmap is dragged.
// ptCur - coordinates of the cursor.
// himl - handle to the image list.
//
// Global variables
//     g_rcImage - bounding rectangle of the image to drag.
//     g_nImage - index of the image.
//     g_ptHotSpot - location of the image's hot spot.
//     g_cxBorder and g_cyBorder - width and height of border.
//     g_cyCaption and g_cyMenu - height of title bar and menu bar.
extern RECT g_rcImage;
extern int g_nImage;
extern POINT g_ptHotSpot;

BOOL StartDragging(HWND hwnd, POINT ptCur, HIMAGELIST himl)
{
    // Return if the cursor is not in the bounding rectangle of
    // the image.
    if (!PtInRect(&g_rcImage, ptCur))
        return FALSE;

    // Capture the mouse input.
    SetCapture(hwnd);

    // Erase the image from the client area.
    InvalidateRect(hwnd, &g_rcImage, TRUE);
    UpdateWindow(hwnd);

    // Calculate the location of the hot spot, and save it.
    g_ptHotSpot.x = ptCur.x - g_rcImage.left;
    g_ptHotSpot.y = ptCur.y - g_rcImage.top;

    // Begin the drag operation.
    if (!ImageList_BeginDrag(himl, g_nImage,
            g_ptHotSpot.x, g_ptHotSpot.y))
        return FALSE;

    // Set the initial location of the image, and make it visible.
    // Because the ImageList_DragEnter function expects coordinates to
    // be relative to the upper-left corner of the given window, the
    // width of the border, title bar, and menu bar need to be taken
    // into account.
    ImageList_DragEnter(hwnd, ptCur.x + g_cxBorder,
        ptCur.y + g_cyBorder + g_cyCaption + g_cyMenu);

    g_fDragging = TRUE;

    return TRUE;
}

Moving the image

The following function, which drags the image to a new location, is intended to be called in response to the WM_MOUSEMOVE message.

// MoveTheImage - drags an image to the specified coordinates.
// Returns TRUE if successful, or FALSE otherwise.
// ptCur - new coordinates for the image.
BOOL MoveTheImage(POINT ptCur)
{
    if (!ImageList_DragMove(ptCur.x, ptCur.y))
        return FALSE;

    return TRUE;
}

Ending the drag operation

The following function ends the drag operation and draws the image in its final location. It also releases the mouse capture.

// StopDragging - ends a drag operation and draws the image
// at its final location.
// Returns TRUE if successful, or FALSE otherwise.
// hwnd - handle to the window in which the bitmap is dragged.
// himl - handle to the image list.
// ptCur - coordinates of the cursor.
//
// Global variable
//     g_ptHotSpot - location of the image's hot spot.

extern POINT g_ptHotSpot;

BOOL StopDragging(HWND hwnd, HIMAGELIST himl, POINT ptCur)
{
    ImageList_EndDrag();
    ImageList_DragLeave(hwnd)

    g_fDragging = FALSE;

    DrawTheImage(hwnd, himl, ptCur.x - g_ptHotSpot.x,
        ptCur.y - g_ptHotSpot.y);

    ReleaseCapture();
    return TRUE;
}

Image Information

There are a number of functions that retrieve information from an image list. The ImageList_GetImageInfo function fills an IMAGEINFO structure with information about a single image, including the handles of the image and mask bitmaps, the number of color planes and bits per pixel, and the bounding rectangle of the image within the image bitmap. You can use this information to directly manipulate the bitmaps for the image. The ImageList_GetImageCount function retrieves the number of images in an image list.

Image Overlays

Every image list includes a list of indexes to use as overlays. An overlay is an image that is drawn transparently over another image. Any image currently in the image list can be used as an overlay. You can specify up to four overlays per image list. This limit has been expanded to 15 in version 4.71.

You add the index of an image to the list of overlays by using the ImageList_SetOverlayImage function, specifying the handle to the image list, the index of the existing image, and the desired overlay index. This, in effect, tells the image list that "the image at index x can be used as an overlay, and I want to refer to the overlay as overlay index y." The overlay indexes are one-based rather than zero-based because an overlay index of zero means that no overlay will be used.

You specify an overlay when drawing an image with the ImageList_Draw or ImageList_DrawEx function. The overlay is specified by performing a logical OR operation between the desired drawing flags and the result of the INDEXTOOVERLAYMASK macro. The INDEXTOOVERLAYMASK macro takes the overlay index and formats it for inclusion with the flags for these functions. This will draw the image with the specified overlay. The following example demonstrates how an overlay is added and specified when drawing the image.

ImageList_SetOverlayImage(himl, 0, 3);
ImageList_Draw(himl, 1, hdc, 0, 0, ILD_MASK | INDEXTOOVERLAYMASK(3));

This will draw image 1 and then overlay that image with image 0. Because 3 is the overlay index that you specified in the ImageList_SetOverlayImage call, 3 is placed in the INDEXTOOVERLAYMASK macro.

Image List Updates in Internet Explorer

The following features were added to the image list by Microsoft Internet Explorer.

Copying Images | Copy or swap images within an image list using the ImageList_Copy function. This function allows you to indicate whether the source image should be copied to the destination index or the source and destination images should be swapped. Currently, this is allowed only within a single image list.
Duplicating Image Lists | Take an existing image list and duplicate all of its parameters and contents into a new image list using the ImageList_Duplicate function. The image list returned by this function is an exact duplicate of the original image list and must be destroyed separately. Changes made to one image list do not affect the other.
Dynamic Resizing of Image Lists | Modify the number of images in an image list on the fly using the ImageList_SetImageCount function. If the number of images is increased, you must use the ImageList_Replace function to place images in the added slots. If the number of images is reduced, the images beyond the new size are freed and are no longer available.
Extended Drawing of Images | You now have more control over the drawing of images with the ImageList_DrawIndirect function. This function takes an IMAGELISTDRAWPARAMS structure that specifies the details that will be used when drawing the image. With this function, you can now specify things like ROP codes when drawing.


IP Address Controls

An Internet Protocol (IP) address control allows the user to enter an IP address in an easily understood format. This control also allows the application to obtain the address in numeric form rather than in text form.

  • About IP Address Controls
  • Using IP Address Controls

About IP Address Controls

Microsoft® Internet Explorer Version 4.0 introduces the IP address control, a new control similar to an edit control that allows the user to enter a numeric address in Internet protocol (IP) format. This format consists of four three-digit fields. Each field is treated individually; the field numbers are zero-based and proceed from left to right as shown in this figure.

The control allows only numeric text to be entered in each of the fields. Once three digits have been entered in a given field, keyboard focus is automatically moved to the next field. If filling the entire field is not required by the application, the user can enter fewer than three digits. For example, if the field should only contain 21, typing 21 and pressing the key will take the user to the next field.

The default range for each field is 0 to 255, but the application can set the range to any values between those limits with the IPM_SETRANGE message.

Note The IP address control is implemented in version 4.71 and later of Comctl32.dll.

Initializing an IP Address Control

To use an IP address control, call InitCommonControlsEx with the ICC_INTERNET_CLASSES flag set in the dwICC member of the INITCOMMONCONTROLSEX structure.

Creating an IP Address Control

Use the CreateWindow or the CreateWindowEx application programming interface (API) to create an IP address control. The class name for the control is WC_IPADDRESS, which is defined in Commctrl.h. No IP address control-specific styles exist; however, because this is a child control, use the WS_CHILD style as a minimum.

Is an IP Address Control an Edit Control?

An IP address control is not an edit control and it will not respond to EM_ messages. It will, however, send the owner window the following edit control notifications through the WM_COMMAND message. Note that the IP address control will also send private IPN_ notifications through the WM_NOTIFY message.

Notification | Reason for notification
EN_SETFOCUS | Sent when the IP address control gains the keyboard focus.
EN_KILLFOCUS | Sent when the IP address control loses the keyboard focus.
EN_CHANGE | Sent when any field in the IP address control changes. Like the EN_CHANGE notification from a standard edit control, this notification is received after the screen has been updated.


About List Boxes

List box items can be represented by text strings, bitmaps, or both. If the list box is not large enough to display all the list box items at once, the list box provides a scroll bar. The user scrolls through the list box items, and applies or removes selection status as necessary. Selecting a list box item changes its visual appearance, usually by changing the text and background colors to those specified by the relevant operating system metrics. When the user selects or deselects an item, the system sends a notification message to the parent window of the list box.

A dialog box procedure is responsible for initializing and monitoring its child windows, including any list boxes. The dialog box procedure communicates with the list box by sending messages to it and by processing the notification messages sent by the list box.

Windows NT/2000/XP: For an ANSI application, the system converts the text in a list box to Unicode using CP_ACP. This can cause problems. For example, accented Roman characters in a non-Unicode list box in Microsoft® Windows®, Japanese version will come out garbled. To fix this, either compile the application as Unicode or use an owner-drawn list box.

For more information about dialog boxes, see Dialog Boxes . For general information about controls, see General Control Information .

This section discusses the following topics.

  • List Box Types and Styles
  • List Box Functions
  • Notification Messages from List Boxes
  • Messages to List Boxes
  • Default Window Message Processing
  • Owner-drawn List Boxes

List Box Types and Styles

There are two types of list boxes: single-selection (the default) and multiple-selection. In a single-selection list box, the user can select only one item at a time. In a multiple-selection list box, the user can select more than one item at a time. To create a multiple-selection list box, specify the LBS_MULTIPLESEL or the LBS_EXTENDEDSEL style.

There are many list box styles and window styles that control the appearance and operation of a list box. These styles indicate whether list box items are sorted, arranged in multiple columns, drawn by the application, and so on. The dimensions and styles of a list box are typically defined in a dialog box template included in an application's resources.

For a table of list box styles, see List Box Styles .

Note To use visual styles with these controls, an application must include a manifest and must call InitCommonControls at the beginning of the program. For information on visual styles, see Visual Styles . For information on manifests, see Using Windows XP Visual Styles .

List Box Functions

The DlgDirList function replaces the contents of a list box with the names of drives, directories, and files that match a specified set of criteria. The DlgDirSelectEx function retrieves the current selection in a list box initialized by DlgDirList. These functions make it possible for the user to select a drive, directory, or file from a list box without typing the location and name of the file.

Also, the GetListBoxInfo function returns the number of items per column in a specified list box.

Notification Messages from List Boxes

When an event occurs in a list box, the list box sends a notification message to the dialog box procedure of the owner window. List box notification messages are sent when a user selects, double-clicks, or cancels a list box item; when the list box receives or loses the keyboard focus; and when the system cannot allocate enough memory for a list box request. A notification message is sent as a WM_COMMAND message in which the low-order word of the wParam parameter contains the list box identifier, the high-order word of wParam contains the notification message, and the lParam parameter contains the control window handle.

A dialog box procedure is not required to process these messages; the default window procedure processes them.

An application should monitor and process the following list box notification messages.

Notification message | Description
LBN_DBLCLK | The user double-clicks an item in the list box.
LBN_ERRSPACE | The list box cannot allocate enough memory to fulfill a request.
LBN_KILLFOCUS | The list box loses the keyboard focus.
LBN_SELCANCEL | The user cancels the selection of an item in the list box.
LBN_SELCHANGE | The selection in a list box is about to change.
LBN_SETFOCUS | The list box receives the keyboard focus.

Messages to List Boxes

A dialog box procedure can send messages to a list box to add, delete, examine, and change list box items. For example, a dialog box procedure could send an LB_ADDSTRING message to a list box to add an item, and an LB_GETSEL message to determine whether the item is selected. Other messages set and retrieve information about the size, appearance, and behavior of the list box. For example, the LB_SETHORIZONTALEXTENT message sets the scrollable width of a list box. A dialog box procedure can send any message to a list box by using the SendMessage or SendDlgItemMessage function.

A list box item is often referenced by its index, an integer that represents the item's position in the list box. The index of the first item in a list box is 0, the index of the second item is 1, and so on.

The following table describes how the predefined list box procedure responds to list box messages.

Message | Response
LB_ADDFILE | Inserts a file into a directory list box filled by the DlgDirList function and retrieves the list box index of the inserted item.
LB_ADDSTRING | Adds a string to a list box and returns its index.
LB_DELETESTRING | Removes a string from a list box and returns the number of strings remaining in the list.
LB_DIR | Adds a list of filenames to a list box and returns the index of the last filename added.
LB_FINDSTRING | Returns the index of the first string in the list box that begins with a specified string..
LB_FINDSTRINGEXACT | Returns the index of the string in the list box that is equal to a specified string.
LB_GETANCHORINDEX | Returns the index of the item that the mouse last selected.
LB_GETCARETINDEX | Returns the index of the item that has the focus rectangle.
LB_GETCOUNT | Returns the number of items in the list box.
LB_GETCURSEL | Returns the index of the currently selected item.
LB_GETHORIZONTALEXTENT | Returns the scrollable width, in pixels, of a list box.
LB_GETITEMDATA | Returns the value associated with the specified item.
LB_GETITEMHEIGHT | Returns the height, in pixels, of an item in a list box.
LB_GETITEMRECT | Retrieves the client coordinates of the specified list box item.
LB_GETLOCALE | Retrieves the locale of the list box. The high-order word contains the country/region code and the low-order word contains the language identifier.
LB_GETSEL | Returns the selection state of a list box item.
LB_GETSELCOUNT | Returns the number of selected items in a multiple-selection list box.
LB_GETSELITEMS | Creates an array of the indexes of all selected items in a multiple-selection list box and returns the total number of selected items.
LB_GETTEXT | Retrieves the string associated with a specified item and the length of the string.
LB_GETTEXTLEN | Returns the length, in characters, of the string associated with a specified item.
LB_GETTOPINDEX | Returns the index of the first visible item in a list box.
LB_INITSTORAGE | Allocates memory for the specified number of items and their associated strings.
LB_INSERTSTRING | Inserts a string at a specified index in a list box.
LB_ITEMFROMPOINT | Retrieves the zero-based index of the item nearest the specified point in a list box.
LB_RESETCONTENT | Removes all items from a list box.
LB_SELECTSTRING | Selects the first string it finds that matches a specified prefix.
LB_SELITEMRANGE | Selects a specified range of items in a list box.
LB_SELITEMRANGEEX | Selects a specified range of items if the index of the first item in the range is less than the index of the last item in the range. Cancels the selection in the range if the index of the first item is greater than the last.
LB_SETANCHORINDEX | Sets the item that the mouse last selected to a specified item.
LB_SETCARETINDEX | Sets the focus rectangle to a specified list box item.
LB_SETCOLUMNWIDTH | Sets the width, in pixels, of all columns in a list box.
LB_SETCOUNT | Sets the number of items in a list box.
LB_SETCURSEL | Selects a specified list box item.
LB_SETHORIZONTALEXTENT | Sets the scrollable width, in pixels, of a list box.
LB_SETITEMDATA | Associates a value with a list box item.
LB_SETITEMHEIGHT | Sets the height, in pixels, of an item or items in a list box.
LB_SETLOCALE | Sets the locale of a list box and returns the previous locale identifier.
LB_SETSEL | Selects an item in a multiple-selection list box.
LB_SETTABSTOPS | Sets the tab stops to those specified in a specified array.
LB_SETTOPINDEX | Scrolls the list box so the specified item is at the top of the visible range.

Default Window Message Processing

The window procedure for the predefined list box window class carries out default processing for all messages that the list box does not process. When the list box procedure returns FALSE for a message, the predefined window procedure checks the message and performs default actions, as shown in the following table.

Message | Default action
WM_CHAR | Moves the selection to the first item that begins with the character the user typed. If the list box has the LBS_OWNERDRAW style, no action occurs. Multiple characters typed within a short interval are treated as a group, and the first item that begins with that series of characters is selected.
WM_CREATE | Creates an empty list box.
WM_DESTROY | Destroys the list box and frees any resources it uses.
 | Passes the message to the dialog box procedure or parent window process.
WM_ENABLE | If the control is visible, invalidates the rectangle so the strings can be painted gray.
WM_ERASEBKGND | Erases the background of a list box. If the list box has the LBS_OWNERDRAW style, the background is not erased.
WM_GETDLGCODE | Returns DLGC_WANTARROWS | DLGC_WANTCHARS, indicating the default list box procedure processes the arrow keys and WM_CHAR messages.
WM_GETFONT | Returns a handle to the current font for the list box.
WM_HSCROLL | Scrolls the list box horizontally.
WM_KEYDOWN | Processes virtual keys for scrolling. The virtual key is the index of the item to move the caret to. The selection is not changed.
WM_KILLFOCUS | Turns the caret off and destroys it. Sends an LBN_KILLFOCUS notification message to the owner of the list box.
WM_LBUTTONDBLCLK | Tracks the mouse in the list box client area. This enables the user to cancel a selection if the mouse button is released outside the list box client area.
WM_LBUTTONDOWN | Tracks the mouse in the list box client area. This enables the user to cancel a selection if the mouse button is released outside the list box client area.
WM_LBUTTONUP | Tracks the mouse in the list box client area. This enables the user to cancel a selection if the mouse button is released outside the list box client area.
WM_MOUSEMOVE | Tracks the mouse in the list box client area. This enables the user to cancel a selection if the mouse button is released outside the list box client area.
 | Performs a subclassed paint operation by using the list box handle to the device context (DC).
WM_SETFOCUS | Turns the caret on and sends an LBN_SETFOCUS notification message to the owner of the list box.
WM_SETFONT | Sets a new font for the list box.
WM_SETREDRAW | Sets or clears the redraw flag based on the value of wParam.
WM_SIZE | Resizes the list box to an integral number of items.
WM_VSCROLL | Scrolls the list box vertically.

The predefined list box procedure passes all other messages to DefWindowProc for default processing.

Owner-drawn List Boxes

An application can create an owner-drawn list box to take responsibility for painting list items. The parent window or dialog box of an owner-drawn list box (its owner) receives WM_DRAWITEM messages when a portion of the list box needs to be painted. An owner-drawn list box can list information other than, or in addition to, text strings.

The owner of an owner-drawn list box must process the WM_DRAWITEM message. This message is sent whenever a portion of the list box must be redrawn. The owner may need to process other messages, depending on the styles specified for the list box.

An application can create an owner-drawn list box by specifying the LBS_OWNERDRAWFIXED or LBS_OWNERDRAWVARIABLE style. If all list items in the list box are the same height, such as strings or icons, an application can use the LBS_OWNERDRAWFIXED style. If list items are of varying height, bitmaps of different size, for example, an application can use the LBS_OWNERDRAWVARIABLE style.

The owner of an owner-drawn list box can process a WM_MEASUREITEM message to specify the dimensions of list items. If the application creates the list box by using the LBS_OWNERDRAWFIXED style, the system sends the WM_MEASUREITEM message only once. The dimensions specified by the owner are used for all list items. If the LBS_OWNERDRAWVARIABLE style is used, the system sends a WM_MEASUREITEM message for each list item added to the list box. The owner can determine or set the height of a list item at any time by using the LB_GETITEMHEIGHT and LB_SETITEMHEIGHT messages, respectively.

If the information displayed in an owner-drawn list box includes text, an application can keep track of the text for each list item by specifying the LBS_HASSTRINGS style. List boxes with the LBS_SORT style are sorted based on this text. If a list box is sorted, but is not of the LBS_HASSTRINGS style, the owner must process the WM_COMPAREITEM message.

In an owner-drawn list box, the owner must keep track of list items containing information other than or in addition to text. One convenient way to do this is to save the handle to the information as item data using the LB_SETITEMDATA message. To free data objects associated with items in a list box, the owner can process the WM_DELETEITEM message.

For an example of an owner-drawn list box, see Creating an Owner-drawn List Box .

Using List Boxes

This section explains how to perform certains tasks associated with list boxes.The following code examples demonstrate how to perform the tasks.
  • Creating a Simple List Box
  • Creating a Directory Listing in a Single-selection List Box
  • Creating a Multiple-selection List Box
  • Creating an Owner-drawn List Box

Creating a Simple List Box

The following example demonstrates how a dialog box procedure creates a simple list box and fills it with the names of people on a softball team. When a name in the list is selected, additional information about the player is displayed in the dialog box. The following illustration shows the dialog box.

The list box has the LBS_STANDARD style, a combination of LBS_SORT, LBS_NOTIFY, WS_VSCROLL, and WS_BORDER. The code initializes the dialog box while processing the WM_INITDIALOG message. For each name that appears in the list box, the code sends an LB_ADDSTRING message to the list box. By processing the LBN_SELCHANGE notification message, the code also keeps track of when the selection changes.

#define BUFFER MAX_PATH

#define NAMELENGTH 15
#define POSITIONLENGTH 20
#define TEAMSIZE 15

typedef struct
{
    TCHAR tchName[NAMELENGTH];
    TCHAR tchPosition[POSITIONLENGTH];
    int nGamesPlayed;
    int nInningsPlayed;
    double xBattingAverage;
    TCHAR tchFoodName[NAMELENGTH];
} Player;

Player Roster[] =
{
        {"Alan", "Center field", 17, 56, .375, "Cannelloni"},
        {"Colin", "Pitcher", 26, 96, .456, "Lefse"},
        {"Cindy", "Second base", 13, 58, .207, "Tequila"},
        {"Dave", "First base", 28, 138, .508, "Suds"},
        {"David", "Center field", 18, 101, .612, "Bok Choy"}
        {"Jack", "Pitcher", 27, 110, .542, "Animal Crackers"},
        {"Julie", "Right field", 22, 101, .509, "Mashed Potatoes"},
        {"Karen", "Second base", 26, 140, .238, "Pez"},
        {"Kathie", "Left field", 26, 127, .353, "Baba Ganouj"},
        {"Matt", "Shortstop", 24, 112, .579, "Oats"},
        {"Miriam", "Right field", 24, 112, .393, "Zotz"},
        {"Pete", "Shortstop", 26, 90, .608, "Beet"},
        {"Seth", "Center field", 20, 76, .407, "Otter Pop"},
        {"Suzanna", "Catcher", 16, 53, .286, "Toast"},
        {"Wendy", "Third base", 25, 154, .493, "Ham"},
    };

BOOL APIENTRY DlgTeamProc(
    HWND hDlg,            // window handle to dialog box
    UINT message,         // type of message
    UINT wParam,          // message-specific information
    LONG lParam)          // message-specific information
{
    TCHAR tchBuffer[BUFFER];
    int nItem;
    int i;
    HWND hwndList;

    switch (message)
    {
        case WM_INITDIALOG:
        {
            hwndList = GetDlgItem(hDlg, IDL_SOFTBALL);

            // Initialize the list box (fill it with player names).

            for (i = 0; i < TEAMSIZE; i++)
            {
                SendMessage(hwndList, LB_ADDSTRING, 0,
                    (LPARAM) Roster[i].tchName);
                SendMessage(hwndList, LB_SETITEMDATA, i, (LPARAM) i);
            }
            SetFocus(hwndList);
            return FALSE;
        }

        case WM_COMMAND:
            switch (LOWORD(wParam))
            {
                case IDL_SOFTBALL:
                    switch (HIWORD(wParam))
                    {
                        case LBN_SELCHANGE:

                           // Show the selected player's statistics.

                           hwndList = GetDlgItem(hDlg, IDL_SOFTBALL);
                           nItem = SendMessage(hwndList, LB_GETCURSEL,
                               0, 0);
                           i = SendMessage(hwndList, LB_GETITEMDATA,
                               nItem, 0);

                           SetDlgItemText(hDlg, IDS_POS,
                               Roster[i].tchPosition);
                           SetDlgItemText(hDlg, IDS_GAME,
                               _itoa(Roster[i].nGamesPlayed,
                               tchBuffer, 10));
                           SetDlgItemText(hDlg, IDS_INN,
                               _itoa(Roster[i].nInningsPlayed,
                               tchBuffer, 10));
                           SetDlgItemText(hDlg, IDS_BA,
                               _gcvt(Roster[i].xBattingAverage,
                               3, tchBuffer));
                           SetDlgItemText(hDlg, IDS_FOOD,
                               Roster[i].tchFoodName);
                           return TRUE;
                   }
                   break;

                case IDOK:
                case IDCANCEL:

                  // Destroy the dialog box.

                  EndDialog(hDlg, TRUE);
                  return TRUE;

                default:
                  return FALSE;
            }

        default:
            return FALSE;
    }
}

Creating a Directory Listing in a Single-selection List Box

The following example demonstrates how to display the content of the current directory in a list box and enable the user to delete one file at a time.

In addition to the standard list box styles, this list box has the LBS_MULTICOLUMN and LBS_HSCROLL styles. The code initializes the list box by using the DlgDirList function to fill the list box with the names of all the files in the current directory. When the user chooses the Delete button, the DlgDirSelectEx function retrieves the name of the selected file. The code deletes the file by using the DeleteFile function and updates the directory list box by sending the LB_DELETESTRING message.

#define BUFFER MAX_PATH

BOOL APIENTRY DlgDelFileProc(
    HWND hDlg,            // window handle to dialog box
    UINT message,         // type of message
    UINT wParam,          // message-specific information
    LONG lParam)
{

    DWORD cchCurDir;
    LPTSTR lpszCurDir;
    LPTSTR lpszFileToDelete;
    int nItem;
    int nTotal;
    TCHAR tchBuffer[BUFFER+1];
    BOOL fResult;

    switch (message)
    {
        case WM_INITDIALOG:

           // Initialize the list box by filling it with files from
           // the current directory.

           lpszCurDir = tchBuffer;
           GetCurrentDirectory(cchCurDir, lpszCurDir);
           lpszCurDir[BUFFER+1] = '\0';
           DlgDirList(hDlg, lpszCurDir, IDL_FILES, IDS_PATHTOFILL, 0);
           SetFocus(GetDlgItem(hDlg, IDL_FILES));
           return FALSE;

        case WM_COMMAND:

            switch (LOWORD(wParam))
            {
                case IDOK:

                    // When the user presses the DEL (IDOK) button,
                    // delete the selected file.

                    lpszFileToDelete = tchBuffer;

                    DlgDirSelectEx(hDlg, lpszFileToDelete, MAX_PATH,
                        IDL_FILES);
                    fResult = DeleteFile(lpszFileToDelete);
                    if (!fResult)
                    {
                        MessageBox(hDlg, "Could not delete file.",
                            NULL, MB_OK);
                    }
                    else
                    {
                        nItem = SendMessage(GetDlgItem(hDlg,
                                IDL_FILES), LB_GETCURSEL, 0, 0);

                        nTotal = SendMessage(GetDlgItem(hDlg,
                            IDL_FILES), LB_DELETESTRING, nItem, 0);

                        // Update the list box.

                        if (nTotal > nItem)
                        {
                            SendMessage(GetDlgItem(hDlg, IDL_FILES),
                                LB_SETCURSEL, nItem, 0);
                        }
                        else
                        {
                            SendMessage(GetDlgItem(hDlg, IDL_FILES),
                                LB_SETCURSEL, nTotal, 0);
                        }
                    }
                    return TRUE;

                case IDCANCEL:

                    // Destroy the dialog box.

                    EndDialog(hDlg, TRUE);
                    return TRUE;

                default:
                    return FALSE;
            }

        default:
            return FALSE;
    }
}

Creating a Multiple-selection List Box

The following example displays and initializes the dialog box used in the preceding example. However, this code uses the LBS_MULTIPLESEL style to enable the user to select more than one file at a time. When the user chooses the Delete button, the example sends the LB_GETSELCOUNT message (to retrieve the number of files selected) and the LB_GETSELITEMS message (to retrieve an array of selected list box items). After deleting a file, the code removes the corresponding item from the list box by sending the LB_DELETESTRING message.

#define BUFFER MAX_PATH

#define BIGBUFF 8192

BOOL APIENTRY DlgDelFilesProc(
    HWND hDlg,            // window handle to dialog box
    UINT message,         // type of message
    UINT wParam,          // message-specific information
    LONG lParam)
{
    DWORD cchCurDir;
    LPTSTR lpszCurDir;
    LPTSTR lpszFileToDelete;
    int nSelItems;
    int nSelItemsInBuffer;
    TCHAR tchBuffer[BUFFER+1];
    TCHAR tchMsgBuff[BUFFER+1];
    int nBuffer[BIGBUFF];
    int i;
    BOOL fResult;
    HWND hListBox;
    HRESULT hr;

    switch (message) {

        case WM_INITDIALOG:

           // Initialize the list box by filling it with files from
           // the current directory.

           lpszCurDir = tchBuffer;
           GetCurrentDirectory(cchCurDir, lpszCurDir);
           lpszCurDir[BUFFER+1] = '\0';
           DlgDirList(hDlg, lpszCurDir, IDL_FILES, IDS_PATHTOFILL, 0);

           SetFocus(GetDlgItem(hDlg, IDL_FILES));

           return FALSE;

        case WM_COMMAND:

            switch (LOWORD(wParam))
            {
                case IDOK:

                    // When the user presses the Delete (IDOK)
                    // button, delete all the selected files.

                    lpszFileToDelete = tchBuffer;

                    hListBox = GetDlgItem(hDlg, IDL_FILES);
                    nSelItems = SendMessage(hListBox,
                            LB_GETSELCOUNT, 0, 0);

                    nSelItemsInBuffer = SendMessage(hListBox,
                            LB_GETSELITEMS, 512, (LPARAM) nBuffer);

                    if (nSelItems > nSelItemsInBuffer)
                    {
                        MessageBox(hDlg, "Too many items selected.",
                                NULL, MB_OK);
                    }
                    else
                    {
                        // Go through the list backwards because after
                        // deleting an item the indices change for
                        // every subsequent item. By going backward,
                        // the indices are never invalidated.

                        for (i = nSelItemsInBuffer - 1; i >= 0; i--)
                        {
                            SendMessage(hListBox, LB_GETTEXT,
                                        nBuffer[i],
                                        (LPARAM) lpszFileToDelete);

                            fResult = DeleteFile(lpszFileToDelete);
                            if (!fResult)
                            {
                                hr = StringCchPrintf(tchMsgBuff,
                                        BUFFER,
                                         "Could not delete file: %s "
                                        "GetLastError = %u",
                                        (LPARAM) lpszFileToDelete);
                                if (FAILED(hr))
                                {
                                //
                                // TODO: write error handler
                                //
                                }

                                // Call app-defined error handler.

                                ErrorHandler(tchMsgBuff);
                            }
                            else
                            {
                                SendMessage(hListBox, LB_DELETESTRING,
                                        nBuffer[i], 0);
                            }
                        }
                        SendMessage(hListBox, LB_SETCARETINDEX, 0, 0);
                    }
                    return TRUE;

                case IDCANCEL:

                    // Destroy the dialog box.

                    EndDialog(hDlg, TRUE);
                    return TRUE;

                default:
                    return FALSE;
            }

        default:
                return FALSE;
    }
}

Creating an Owner-drawn List Box

The following example shows how to draw a list box that contains five owner-drawn items: four drawing implements and a fork. Each list item appears as a bitmap followed by the name of the object. A button prompts the user to select one item that is not like the others. Choosing the button with the fork selected displays a "You're right!" message and closes the dialog box. Choosing the button with any other list item selected displays a "Try again!" message.

The list box has the LBS_OWNERDRAW and LBS_HASSTRINGS styles, in addition to the standard list box styles. The code initializes the list box by sending the LB_ADDSTRING message to set the text, and then sends the LB_SETITEMDATA message to associate a bitmap with each list box item. The code also sets the height of each list box item by processing the WM_MEASUREITEM message and draws the text and bitmap for each item by processing the WM_DRAWITEM message.

#define XBITMAP 80
#define YBITMAP 20

#define BUFFER MAX_PATH

HBITMAP hbmpPencil, hbmpCrayon, hbmpMarker, hbmpPen, hbmpFork;
HBITMAP hbmpPicture, hbmpOld;

void AddItem(HWND hwnd, LPSTR lpstr, HBITMAP hbmp)
{
    int nItem;

    nItem = SendMessage(hwndList, LB_ADDSTRING, 0, lpstr);
    SendMessage(hwndList, LB_SETITEMDATA, nItem, hbmp);
}

DWORD APIENTRY DlgDrawProc(
        HWND hDlg,            // window handle to dialog box
        UINT message,         // type of message
        UINT wParam,          // message-specific information
        LONG lParam)
{
    int nItem;
    TCHAR tchBuffer[BUFFER];
    HBITMAP hbmp;
    HWND hListBox;
    TEXTMETRIC tm;
    int y;
    HDC hdcMem;
    LPMEASUREITEMSTRUCT lpmis;
    LPDRAWITEMSTRUCT lpdis;
    RECT rcBitmap;
    HRESULT hr;
    size_t * pcch;

    switch (message)
    {

        case WM_INITDIALOG:

            // Load bitmaps.

            hbmpPencil = LoadBitmap(hinst, MAKEINTRESOURCE(700));
            hbmpCrayon = LoadBitmap(hinst, MAKEINTRESOURCE(701));
            hbmpMarker = LoadBitmap(hinst, MAKEINTRESOURCE(702));
            hbmpPen = LoadBitmap(hinst, MAKEINTRESOURCE(703));
            hbmpFork = LoadBitmap(hinst, MAKEINTRESOURCE(704));

            // Retrieve list box handle.

            hListBox = GetDlgItem(hDlg, IDL_STUFF);

            // Initialize the list box text and associate a bitmap
            // with each list box item.

            AddItem(hListBox, "pencil", hbmpPencil);
            AddItem(hListBox, "crayon", hbmpCrayon);
            AddItem(hListBox, "marker", hbmpMarker);
            AddItem(hListBox, "pen",    hbmpPen);
            AddItem(hListBox, "fork",   hbmpFork);

            SetFocus(hListBox);
            SendMessage(hListBox, LB_SETCURSEL, 0, 0);
            return TRUE;

        case WM_MEASUREITEM:

            lpmis = (LPMEASUREITEMSTRUCT) lParam;

            // Set the height of the list box items.

            lpmis->itemHeight = 20;
            return TRUE;

        case WM_DRAWITEM:

            lpdis = (LPDRAWITEMSTRUCT) lParam;

            // If there are no list box items, skip this message.

            if (lpdis->itemID == -1)
            {
                break;
            }

            // Draw the bitmap and text for the list box item. Draw a
            // rectangle around the bitmap if it is selected.

            switch (lpdis->itemAction)
            {
                case ODA_SELECT:
                case ODA_DRAWENTIRE:

                    // Display the bitmap associated with the item.

                    hbmpPicture =(HBITMAP)SendMessage(lpdis->hwndItem,
                        LB_GETITEMDATA, lpdis->itemID, (LPARAM) 0);

                    hdcMem = CreateCompatibleDC(lpdis->hDC);
                    hbmpOld = SelectObject(hdcMem, hbmpPicture);

                    BitBlt(lpdis->hDC,
                        lpdis->rcItem.left, lpdis->rcItem.top,
                        lpdis->rcItem.right - lpdis->rcItem.left,
                        lpdis->rcItem.bottom - lpdis->rcItem.top,
                        hdcMem, 0, 0, SRCCOPY);

                    // Display the text associated with the item.

                    SendMessage(lpdis->hwndItem, LB_GETTEXT,
                        lpdis->itemID, (LPARAM) tchBuffer);

                    GetTextMetrics(lpdis->hDC, &tm);

                    y = (lpdis->rcItem.bottom + lpdis->rcItem.top -
                        tm.tmHeight) / 2;

                    hr = StringCchLength(tchBuffer, BUFFER, pcch);
                    if (FAILED(hr))
                    {
                    // TODO: write error handler
                    }

                    TextOut(lpdis->hDC,
                        XBITMAP + 6,
                        y,
                        tchBuffer,
                        pcch);

                    SelectObject(hdcMem, hbmpOld);
                    DeleteDC(hdcMem);

                    // Is the item selected?

                    if (lpdis->itemState & ODS_SELECTED)
                    {
                        // Set RECT coordinates to surround only the
                        // bitmap.

                        rcBitmap.left = lpdis->rcItem.left;
                        rcBitmap.top = lpdis->rcItem.top;
                        rcBitmap.right = lpdis->rcItem.left + XBITMAP;
                        rcBitmap.bottom = lpdis->rcItem.top + YBITMAP;

                        // Draw a rectangle around bitmap to indicate
                        // the selection.

                        DrawFocusRect(lpdis->hDC, &rcBitmap);
                    }
                    break;

                case ODA_FOCUS:

                    // Do not process focus changes. The focus caret
                    // (outline rectangle) indicates the selection.
                    // The IDOK button indicates the final
                    // selection.

                    break;
            }
            return TRUE;

        case WM_COMMAND:

            switch (LOWORD(wParam))
            {
                case IDOK:
                    // Get the selected item's text.

                    nItem = SendMessage(GetDlgItem(hDlg, IDL_STUFF),
                       LB_GETCURSEL, 0, (LPARAM) 0);
                       hbmp = SendMessage(GetDlgItem(hDlg, IDL_STUFF),
                            LB_GETITEMDATA, nItem, 0);

                    // If the item is not the correct answer, tell the
                    // user to try again.
                    //
                    // If the item is the correct answer, congratulate
                    // the user and destroy the dialog box.

                    if (hbmp != hbmpFork)
                    {
                        MessageBox(hDlg, "Try again!", "Oops", MB_OK);
                        return FALSE;
                    }
                    else
                    {
                        MessageBox(hDlg, "You're right!",
                            "Congratulations.", MB_OK);

                      // Fall through.

                    }

                case IDCANCEL:

                    // Destroy the dialog box.

                    EndDialog(hDlg, TRUE);
                    return TRUE;

                default:

                    return FALSE;
            }

        case WM_DESTROY:

            // Free any resources used by the bitmaps.

            DeleteObject(hbmpPencil);
            DeleteObject(hbmpCrayon);
            DeleteObject(hbmpMarker);
            DeleteObject(hbmpPen);
            DeleteObject(hbmpFork);

            return TRUE;

        default:
            return FALSE;

    }
    return FALSE;
}


List

List-View Controls

A list-view control is a window that displays a collection of items; each item consists of an icon and a label. List-view controls provide several ways to arrange and display items. For example, additional information about each item can be displayed in columns to the right of the icon and label. The following illustration shows a window with a list-view control in icon view.

  • List-View Creation
  • List-View Styles and Views
  • List-View Working Areas
  • List-View Image Lists
  • List-View Items and Subitems
  • List-View Columns
  • List-View Scroll Position
  • List-View Label Editing
  • List-View Colors
  • List-View Features Supported in Windows XP

List-View Creation

To create a list-view control, call the CreateWindow or CreateWindowEx function and specify the WC_LISTVIEW window class. This window class is registered when the common controls dynamic-link library (DLL) loads. To ensure that this DLL loads, use the InitCommonControls or InitCommonControlsEx function. Because list-view controls display both icons and text, as part of the creation process you must load the bitmaps and insert the text items.

Normally you will use the resource editor to create a list view control.

List-View Styles and Views

List-view controls display items in four different views. The control's window style specifies the current view. Additional window styles specify the alignment of items and control-specific features. The following table describes the four views.

View Name | Description
Icon view | Specified by the LVS_ICON window style. Each item appears as a full-sized icon with a label below it. The user can drag the items to any location in the list-view window.
Small icon view | Specified by the LVS_SMALLICON window style. Each item appears as a small icon with the label to the right of it. The user can drag the items to any location.
List view | Specified by the LVS_LIST window style. Each item appears as a small icon with a label to the right of it. Items are arranged in columns and the user cannot drag them to an arbitrary location.
Report view | Specified by the LVS_REPORT window style. Each item appears on its own line, with information arranged in columns. The leftmost column is always left justified and contains the small icon and label. Subsequent columns contain subitems as specified by the application. Each column has a header, unless you also specify the LVS_NOCOLUMNHEADER window style.

You can change the view type after you create a list-view control. To retrieve and change the window style, use the GetWindowLong and SetWindowLong functions. To determine the window styles of the current view, use the LVS_TYPEMASK value.

You can control the way items are arranged in icon or small icon view by specifying either the LVS_ALIGNTOP (default) or LVS_ALIGNLEFT window style.

You can change the alignment after you create a list-view control. To determine the current alignment, use the LVS_ALIGNMASK value.

Additional window styles provide other options, such as whether a user can edit labels or select more than one item at a time. For a complete list, see List-View Window Styles .

Extended List-View Styles

The extended list-view control styles provide options such as check boxes, flat scroll bars, grid lines, and hot-tracking. For a complete list, see Extended List-View Styles . You do not access extended list-view styles in the same manner as standard window styles. You do not use the GetWindowLong and SetWindowLong functions to make extended style changes.

There are two messages that set and retrieve extended style information, LVM_SETEXTENDEDLISTVIEWSTYLE and LVM_GETEXTENDEDLISTVIEWSTYLE . Instead of sending the messages explicitly, you can use the following corresponding macros: ListView_SetExtendedListViewStyle , ListView_SetExtendedListViewStyleEx , and ListView_GetExtendedListViewStyle .

Virtual List-View Style

A virtual list view is a list-view control that has the LVS_OWNERDATA style. This style enables the control to handle millions of items because the owner receives the burden of managing item data. This allows you to use the virtual list-view control with large databases of information, where specific methods of data access are already in place.

A virtual list-view control maintains very little item information itself. Except for the item selection and focus information, the owner of the control must manage all item information. Other processes request item information from the owner by using LVN_GETDISPINFO notification messages.

Because this type of list control is intended for large data sets, it is recommended that you cache requested item data to improve retrieval performance. The list view provides a cache-hinting mechanism to assist in optimizing the cache. The hint is implemented in the form of an LVN_ODCACHEHINT notification message.

Creating a Virtual List-View Control

You create virtual list-view controls using the CreateWindow or CreateWindowEx function, specifying the LVS_OWNERDATA window style as part of the dwStyle function parameter.

You can use the LVS_OWNERDATA style in combination with most other window styles, except the LVS_SORTASCENDING or LVS_SORTDESCENDING style. All virtual list-view controls default to the LVS_AUTOARRANGE style.

Note Dynamically switching to and from the LVS_OWNERDATA style is not supported.

Compatibility Issues

All four of the list-view styles—icon, small icon, list, and report view—support the LVS_OWNERDATA style. List-view controls that have the LVS_OWNERDATA style do not store any item-specific information. Therefore, the only valid item state flags that you can apply to an item are LVIS_SELECTED and LVIS_FOCUSED . No other state information is stored. In particular, the list-view control does not maintain state or overlay images for each item. However, you can have the list-view control query your application for these images by sending it an LVM_SETCALLBACKMASK message.

Most list-view control messages and the associated macros are fully supported. However, some messages have limitations or are unsupported when you use the LVS_OWNERDATA style. The following table summarizes the affected messages.

Message | Limitation
LVM_ARRANGE | Does not support the LVA_SNAPTOGRID style.
LVM_DELETEALLITEMS | Sets the item count to zero and clears all internal selection variables, but it does not actually delete any items. It makes a notification callback.
LVM_DELETEITEM | Is supported for selection integrity only and does not actually delete an item.
LVM_GETITEMSTATE | Returns only focus and selection states (that is, those states stored by the list-view control).
LVM_GETNEXTITEM | Does not support the list-view search criteria LVNI_CUT, LVNI_HIDDEN, or LVNI_DROPHILITED. All other criteria are supported.
LVM_GETWORKAREAS | Is not supported.
LVM_INSERTITEM | Is supported for selection integrity only.
LVM_SETITEM | Is not supported. To set the item state, use the ListView_SetItemState message.
LVM_SETITEMCOUNT | Sets the number of items currently in the list. If the list-view control sends a notification that requests data for any item up to the maximum set, the owner must be prepared to supply that data. The message parameters support virtual list-view controls.
LVM_SETITEMPOSITION | Is not supported.
LVM_SETITEMSTATE | Allows only the selection and focus states to be changed for the item.
LVM_SETITEMTEXT | Is not supported. It is the application's responsibility to maintain the item texts.
LVM_SETWORKAREAS | Is not supported.
LVM_SORTITEMS | Is not supported. It is the application's responsibility to present the items in the desired order.

Handling Virtual List-View Control Notification Messages

List-view controls with the LVS_OWNERDATA style send the same notification messages as other list-view controls and two additional ones: LVN_ODCACHEHINT and LVN_ODFINDITEM . The following are the most common notifications that the list-view control with the LVS_OWNERDATA style sends.

LVN_GETDISPINFO | A virtual list-view control maintains very little item information on its own. As a result, it often sends the LVN_GETDISPINFO notification message to request item information. This message is handled in much the same way as callback items in a standard list control. Because the number of items supported by the control can be very large, caching item data improves performance. When handling LVN_GETDISPINFO, the owner of the control first attempts to supply requested item information from the cache (for more information, see Cache Management). If the requested item is not cached, the owner must be prepared to supply the information by other means.
LVN_ODCACHEHINT | A virtual list view sends the LVN_ODCACHEHINT notification message to assist in optimizing the cache. The notification message provides inclusive index values for a range of items that it recommends be cached. Upon receiving the notification message, the owner must be prepared to load the cache with item information for the requested range so that the information will be readily available when an LVN_GETDISPINFO message is sent.
LVN_ODFINDITEM | The LVN_ODFINDITEM notification message is sent by a virtual list-view control when the control needs the owner to find a particular callback item. The notification message is sent when the list-view control receives quick key access or when it receives an LVM_FINDITEM message. Search information is sent in the form of an LVFINDINFO structure, which is a member of the NMLVFINDITEM structure. The owner must be prepared to search for an item that matches the information given by the list-view control. The owner returns the index of the item if successful, or -1 if no matching item is found.

Cache Management

A list-view control with the LVS_OWNERDATA style produces a large number of LVN_GETDISPINFO notification messages and, to assist in optimizing the cache, an LVN_ODCACHEHINT message. LVN_ODCACHEHINT messages provide information about the recommended items to include within the cache. These messages are sent as WM_NOTIFY messages, with the lParam value acting as the address of an NMLVCACHEHINT structure.

The NMLVCACHEHINT structure includes two integer members, iFrom and iTo, that represent the inclusive endpoints of a range of items that most likely will be needed. The owner must be prepared to load the cache with the item information for each of the items within the recommended range.

The list control often needs item information for the first item (offset 0). The LVN_ODCACHEHINT notification message might not always include item 0, but it must always be included in the cache.

The last items in the list are accessed often. Therefore, the owner might want to keep a second cache that includes the items at the end of the list. The requested range from LVN_ODCACHEHINT can be checked against the end cache to make it available automatically instead of reloading the same end range each time.

List-View Working Areas

List-view controls support working areas, which are rectangular virtual areas that the list-view control uses to arrange its items. A working area is not a window and cannot have a visible border. By default, the list-view control has no working areas. By creating a working area, you can create an empty border on the left, top, or right of the items or cause a horizontal scroll bar to be displayed when there normally would not be one.

The number of working areas can be retrieved with the LVM_GETNUMBEROFWORKAREAS message. The working areas are changed with the LVM_SETWORKAREAS message and can be retrieved with the LVM_GETWORKAREAS message. Both of these messages take the address of an array of RECT structures as the lParam and the number of RECT structures as the wParam. The left and top members of these structures specify the coordinates of the upper-left corner (the origin) of the working area, and the right and bottom members specify the lower-right corner of the working area. All the coordinates are in client coordinates of the list view. The maximum number of working areas allowed is defined by the LV_MAX_WORKAREAS value.

Changing the working area has no effect on list-view controls that have the LVS_LIST or LVS_REPORT view, but the working areas will be maintained when the view type is changed. With the LVS_ICON and LVS_SMALLICON views, the working area can be modified to change the way the items are displayed. Making the width of the working area (right - left) greater than the client width of the control causes the items to be wrapped at that width and the horizontal scroll bar to be displayed. Making the width of the working area narrower than the width of the control's client area causes the items to be wrapped within the working area and not the client area. Setting the left or top member to a positive value causes the items to be displayed starting at the working area, creating an empty space between the edge of the control and the items. An empty space can also be created between the right edge of the control and the items by making the width of the working area less than the client width of the control.

List-View Image Lists

By default, a list-view control does not display item images. To display item images, you must create image lists and associate them with the control. A list-view control can have three image lists:

  • An image list that contains full-sized icons displayed when the control is in icon view.
  • An image list that contains small icons displayed when the control is in small icon view, list view, or report view.
  • An image list that contains state images, which are displayed to the left of the full-sized or small icon. You can use state images, such as checked and cleared check boxes, to indicate application-defined item states. State images are displayed in icon view, small icon view, list view, and report view.

The full-sized and small icon image lists can also contain overlay images, which are designed to be drawn transparently over the item icons.

To use overlay images in a list-view control:

  1. Call the ImageList_SetOverlayImage function to assign an overlay image index to an image in the full-sized and small icon image lists. An overlay image is identified by a one-based index.
  2. You can associate an overlay image index with an item when you call the ListView_InsertItem or ListView_SetItem macro. Use the INDEXTOOVERLAYMASK macro to specify an overlay image index in the state member of the item's LVITEM structure. You must also set the LVIS_OVERLAYMASK bits in the stateMask member.

If a state image list is specified, a list-view control reserves space to the left of each item's icon for a state image.

To associate a state image with an item, use the INDEXTOSTATEIMAGEMASK macro to specify a state image index in the state member of the LVITEM structure. The index identifies an image in the control's state image list. Although image list indexes are zero-based, the control uses one-based indexes to identify state images. A state image index of zero indicates that an item has no state image.

By default, when a list-view control is destroyed, it destroys the image lists assigned to it. However, if a list-view control has the LVS_SHAREIMAGELISTS window style, the application is responsible for destroying the image lists when they are no longer in use. You should specify this style if you assign the same image lists to multiple list-view controls; otherwise, more than one control might try to destroy the same image list.

List-View Items and Subitems

Each item in a list-view control has an icon, a label, a current state, and an application-defined value. By using list-view messages, you can add, modify, and delete items as well as retrieve information about items.

Each item can have one or more subitems. A subitem is a string that, in report view, is displayed in a column separate from the item's icon and label. To specify the text of a subitem, use the LVM_SETITEMTEXT or LVM_SETITEM message. All items in a list-view control have the same number of subitems. The number of subitems is determined by the number of columns in the list-view control. When you add a column to a list-view control, you specify its associated subitem index.

The LVITEM structure defines a list-view item or subitem. The iItem member is the zero-based index of the item. The iSubItem member is the one-based index of a subitem or zero if the structure contains information about an item. Additional members specify the item's text, icon, state, and item data. Item data is an application-defined value associated with a list-view item.

To add an item to a list-view control, use the LVM_INSERTITEM message, specifying the address of an LVITEM structure. Before adding multiple items, you can send the control an LVM_SETITEMCOUNT message, specifying the number of items the control will ultimately contain. This message enables the list-view control to reallocate its internal data structures only once rather than every time you add an item. You can determine the number of items in a list-view control by using the LVM_GETITEMCOUNT message. If you are adding a large number of items to a list-view control, you can speed up the process by disabling redrawing before adding the items, then enable redrawing after the items are added. Use the WM_SETREDRAW message to enable and disable redrawing.

To change the attributes of a list-view item, use the LVM_SETITEM message, specifying the address of an LVITEM structure. The mask member of this structure specifies the item attributes you want to change. For example, to change only the text of an item or subitem, use the LVM_SETITEMTEXT message.

To retrieve information about a list-view item, use the LVM_GETITEM message, specifying the address of the LVITEM structure to fill in. The mask member of this structure specifies the item attributes to be retrieved. To retrieve only an item or subitem's text, use the LVM_GETITEMTEXT message.

To delete a list-view item, use the LVM_DELETEITEM message. You can delete all items in a list-view control by using the LVM_DELETEALLITEMS message.

List-View Item States

An item's state is a value that specifies the item's availability, indicates user actions, or otherwise reflects the item's status. A list-view control changes some state bits, such as when the user selects an item. An application might change other state bits to disable or hide the item or to specify an overlay image or state image. For more information about overlay images and state images, see List-View Image Lists.

An item's state is specified by the state member of the LVITEM structure. When you specify or change an item's state, the stateMask member specifies which state bits you need to change. You can change an item's state by using the LVM_SETITEMSTATE message. You can specify an item's state when you create it or when you change its attributes by using the LVM_SETITEM message. To determine an item's current state, use the LVM_GETITEMSTATE or LVM_GETITEM message.

To set an item's overlay image, the stateMask member of the LVITEM structure must include the LVIS_OVERLAYMASK value, and the state member must include the one-based index of the overlay image shifted left 8 bits by using the INDEXTOOVERLAYMASK macro. The index can be zero to specify no overlay image.

To set an item's state image, the stateMask member of the LVITEM structure must include the LVIS_STATEIMAGEMASK value, and the state member must include the one-based index of the state image shifted left 12 bits by using the INDEXTOSTATEIMAGEMASK macro. The index can be zero to specify no state image.

Callback Items and the Callback Mask

For each of its items, a list-view control typically stores the label text, the image list index of the item's icons, and a set of bit flags for the item's state. You can define callback items or change the control's callback mask to indicate that the application, rather than the control, stores some or all of this information. You might want to use callbacks if your application stores some of this information.

A callback item in a list-view control is an item for which the application stores the text or icon index, or both. You can define callback items when you send the LVM_INSERTITEM message to add an item to the list-view control. If the application stores the text for the item or subitem, set the pszText member of the item's LVITEM structure to LPSTR_TEXTCALLBACK. If the application stores the icon index for an item, set the iImage member of the item's LVITEM structure to I_IMAGECALLBACK.

The callback mask of a list-view control is a set of bit flags that specify the item states for which the application, rather than the control, stores the current data. The callback mask applies to all of the control's items, unlike the callback item designation, which applies to a specific item. The callback mask is zero by default, meaning that the list-view control stores all item state information. After creating a list-view control and initializing its items, you can send the LVM_SETCALLBACKMASK message to change the callback mask. To retrieve the current callback mask, send the LVM_GETCALLBACKMASK message.

When a list-view control must display or sort a list-view item for which the application stores callback information, the control sends the LVN_GETDISPINFO notification message to the control's parent window. This message specifies an NMLVDISPINFO structure that contains the type of information required and identifies the item or subitem to retrieve. The parent window must process LVN_GETDISPINFO to provide the requested data.

If the list-view control detects a change in an item's callback information, such as a change in the text, icon, or state information, the control sends an LVN_SETDISPINFO notification message to notify you of the change.

If you change a callback item's attributes or state bits, you use the LVM_UPDATE message to force the control to repaint the item. This message also causes the control to arrange its items if it has the LVS_AUTOARRANGE style. You can use the LVM_REDRAWITEMS message to redraw a range of items by invalidating the corresponding portions of the list-view control's client area.

By effectively using callback items and the callback mask, you can ensure that each item attribute is maintained in only one place. Doing this can simplify your application, but the only space saved is the memory that would otherwise be required to store item labels and subitem text.

List-View Item Position

Every list-view item has a position and size, which you can retrieve and set using messages. You can also determine which item, if any, is at a specified position. The position of list-view items is specified in view coordinates, which are client coordinates offset by the scroll position.

To retrieve and set an item's position, use the LVM_GETITEMPOSITION and LVM_SETITEMPOSITION messages. LVM_GETITEMPOSITION works for all views, but LVM_SETITEMPOSITION works only for icon and small icon views.

You can determine which item, if any, is at a particular location by using the LVM_HITTEST message.

To retrieve the bounding rectangle for a list item or only for its icon or label, use the LVM_GETITEMRECT message.

Arranging, Sorting, and Finding Items

You can use list-view messages to arrange and sort items and to find items based on their attributes or positions. Arranging repositions items to align on a grid, but the indexes of the items do not change. Sorting changes the sequence of items (and their corresponding indexes) and then repositions them accordingly. You can arrange items only in icon and small icon views, but you can sort items in any view. To find items, you send list-view messages that specify an item location or property.

To arrange items, use the LVM_ARRANGE message. You can ensure that items are arranged at all times by specifying the LVS_AUTOARRANGE window style.

To sort items, use the LVM_SORTITEMS message. When you sort using this message, you specify an application-defined callback function that the list-view control calls to compare the relative order of any two items. The control passes to the comparison function the item data associated with each of the two items. The item data is the value that was specified in the lParam member of the item's LVITEM structure when it was inserted into the list. By specifying the appropriate item data and supplying an appropriate comparison function, you can sort items by their label, by any subitem, or by any other property. Note that sorting items does not reorder the corresponding subitems. When items are reordered, their corresponding subitems are carried with them; that is, whole rows are kept together. To order the columns separately from one another, detaching the subitems from their items, you must regenerate the columns after sorting using LVM_SETITEM.

You can ensure that a list-view control is always sorted by specifying the LVS_SORTASCENDING or LVS_SORTDESCENDING window style. Controls with these styles use the label text of the items to sort them in ascending or descending order. You cannot supply a comparison function when using these window styles. If a list-view control has either of these styles, an LVM_INSERTITEM message will fail if you try to insert an item that has LPSTR_TEXTCALLBACK as the pszText member of its LVITEM structure.

You can find a list-view item with specific properties by using the LVM_FINDITEM message. You can find a list-view item that is in a specified state and has a specified relationship to a given item by using the LVM_GETNEXTITEM message. For example, you can retrieve the next selected item to the right of a specified item.

List-View Columns

Columns control the way items and their subitems are displayed in report view. Each column has a title and width and is associated with a specific subitem; subitem zero is the item's icon and label. The attributes of a column are defined by an LVCOLUMN structure.

To add a column to a list-view control, use the LVM_INSERTCOLUMN message. To delete a column, use the LVM_DELETECOLUMN message. Note that you cannot delete column zero of a list-view control. You can retrieve and change the properties of an existing column by using the LVM_GETCOLUMN and LVM_SETCOLUMN messages. To retrieve or change a column's width, use the LVM_GETCOLUMNWIDTH and LVM_SETCOLUMNWIDTH messages.

Unless the LVS_NOCOLUMNHEADER window style is specified, column headers appear in report view. The user can click a column header, causing an LVN_COLUMNCLICK notification message to be sent to the parent window. Typically, the parent window sorts the list-view control by the specified column when this clicking occurs. The user can also drag the column guides between the headers to size the columns.

List-view controls can display images next to column titles. To implement this feature, specify the LVCF_IMAGE value and assign the index of the image to the iImage member in the LVCOLUMN structure.

List-view controls can set the order in which columns are displayed. To implement this feature, specify the LVCF_ORDER value and assign the column order to the iOrder member in the LVCOLUMN structure. The column order is zero-based and is in left-to-right order. For example, zero indicates the leftmost column.

List-View Scroll Position

Unless the LVS_NOSCROLL window style is specified, a list-view control can be scrolled to show more items than can fit in the client area of the control. You can retrieve a list-view control's scroll position and related information, scroll a list-view control by a specified amount, or scroll a list-view control so that a specified list item is visible.

In icon view or small icon view, the current scroll position is defined by the view origin. The view origin is the set of coordinates, relative to the visible area of the list-view control, that correspond to the view coordinates (0, 0). To retrieve the current view origin, use the LVM_GETORIGIN message. This message should be used only in icon or small icon view; it returns an error in list or report view.

In list or report view, the current scroll position is defined by the top index. The top index is the index of the first visible item in the list-view control. To retrieve the current top index, use the LVM_GETTOPINDEX message. This message returns a valid result only in list or report view; it returns zero in icon or small icon view.

You can use the LVM_GETVIEWRECT message to retrieve the bounding rectangle of all items in a list-view control, relative to the visible area of the control.

The LVM_GETCOUNTPERPAGE message returns the number of items that fit in one page of the list-view control. This message returns a valid result only in list and report views; in icon and small icon views, it returns the total number of items.

To scroll a list-view control by a specific amount, use the LVM_SCROLL message. Using the LVM_ENSUREVISIBLE message, you can scroll the list-view control, if necessary, to ensure that a specified item is visible.

List-View Label Editing

A list-view control that has the LVS_EDITLABELS window style enables a user to edit item labels in place. The user begins editing by clicking the label of an item that has the focus. Alternatively, an application can begin editing automatically by using the LVM_EDITLABEL message. The list-view control notifies the parent window when editing begins and when it is canceled or completed. When editing is completed, the parent window is responsible for updating the item's label, if appropriate.

When label editing begins, an edit control is created, positioned, and initialized. Before it is displayed, the list-view control sends its parent window an LVN_BEGINLABELEDIT notification message. If you need to modify the label editing process, you can implement a handler for this notification.

One use for an LVN_BEGINLABELEDIT notification handler is to control which labels the user can edit. To prevent label editing, return a nonzero value. To customize label editing, have the notification handler retrieve a handle to the edit control by sending an LVM_GETEDITCONTROL message to the list-view control. Once you have that handle, you can customize the edit control by sending the usual EM_XXX messages. For instance, to limit the amount of text a user can enter, send the edit control an EM_LIMITTEXT message. You can change the edit control's default text with SetWindowText . You can even subclass the edit control to intercept and discard invalid characters.

When label editing is canceled or completed, a list-view control sends its parent window an LVN_ENDLABELEDIT notification message. The lParam parameter is the address of an NMLVDISPINFO structure. The item member of this structure is an LVITEM structure whose iItem member identifies the item. If editing is canceled, the pszText member of the LVITEM structure is NULL; otherwise, pszText is the address of the edited text. The parent window is responsible for updating the item's label if it wants to keep the new label.

List-View Colors

An application can retrieve and set three colors for a list-view control.

Color | Messages used to retrieve and set colors
Text color | LVM_GETTEXTCOLOR , LVM_SETTEXTCOLOR
Text background color | LVM_GETTEXTBKCOLOR , LVM_SETTEXTBKCOLOR
Window background color | LVM_GETBKCOLOR , LVM_SETBKCOLOR

To customize the appearance of a list-view control more significantly, use NM_CUSTOMDRAW (list view) . For applications that run on the Windows XP operating system you can apply visual styles to customize the control's appearance. For information on using visual styles see Visual Styles and Using Windows XP Visual Styles .

List-View Features Supported in Windows XP

The list-view control in the updated version of the common controls delivered with Windows XP contains features that enable you to provide an intuitive interface for your applications and to present visual information more effectively. The features include:

  • Grouping. This makes it easier for users to scan large lists for relevant information.
  • Insertion marks. This enables users to visually follow the changing location of files during and after drag-and-drop operations.
  • Tile view. This provides a compact, yet informative, method for displaying directory, file and other information.

You can also apply visual styles to common controls defined by ComCtl32.dll version 6. Applying visual styles enables you to define the appearance of controls and windows. If you want your application to use visual styles, you must add an application manifest to ensure that ComCtl32.dll version 6 is available. For more information about using manifests and visual styles see Using Windows XP Visual Styles.

Grouping

The grouping features of the list-view control in Windows XP, enable you to visually group logically related sets of items. These groups are separated on the screen by a horizontal group header that contains the title and the number of items in the group. The following image shows some grouped items.

The grouping application programming interface (API) enables group and group element management by providing messages that add items to groups, add groups to views, sort group items, and query groups for item size and other information.

Insertion Marks

Insertion marks show users where dragged items will be placed. Insertion marks currently display when the user drags an item into the Start menu or Quick Launch bar. The insertion mark also works for lists that are set to autoarrange. When a user drags an item to a point between two other items, the insertion mark shows the item's expected new location. The following image shows an insertion mark.

The insertion mark API elements enable placement of insertion marks by providing messages and flags that perform hit detection, that specify the location and appearance of the insertion mark by item, and that query for information about the current size and appearance of the insertion mark.

Tile View

The tile-view features of the list-view control enable you to provide a visual balance between graphical and textual information. The textual information displayed for an item in tile view is the same as the columns information defined for report view. Tile view functions in combination with either the grouping or insertion mark features in the list-view control. The tile view uses a 32 x 32 icon and several lines of text, as shown in the following image.

The tile-view APIs enable you to specify which column fields to display for each item, and to collectively control the size and appearance of all items within a tile-view window. For clarity, the first line of text in a tile is always the item's name.


Header Controls

A header control is a window that is usually positioned above columns of text or numbers. It contains a title for each column, and it can be divided into parts. The user can drag the dividers that separate the parts to set the width of each column. The following illustration shows a header control that has labeled columns that give detailed information about files in a directory.

  • Using Header Controls
  • Header Control Updates in Internet Explorer

Using Header Controls

You can create a header control by using the CreateWindowEx function, specifying the WC_HEADER window class and the appropriate Header Control Styles . This window class is registered when the common control dynamic-link library (DLL) is loaded. To ensure that this DLL is loaded, use the InitCommonControlsEx function. After you create a header control, you can divide it into parts, set the text in each part, and control the appearance of the window by using header window messages.

Header Control Size and Position

Typically, you must set the size and position of a header control to fit within the boundaries of a particular rectangle, such as the client area of a window. By using the HDM_LAYOUT message, you can retrieve the appropriate size and position values from the header control.

When sending HDM_LAYOUT, you specify the address of an HDLAYOUT structure that contains the coordinates of the rectangle that the header control is to occupy and provides a pointer to a WINDOWPOS structure. The control fills the WINDOWPOS structure with size and position values appropriate for positioning the control along the top of the specified rectangle. The height value is the sum of the heights of the control's horizontal borders and the average height of characters in the font currently selected into the control's device context.

If you want to use HDM_LAYOUT to set the initial size and position of a header control, set the initial visibility state of the control so that it is hidden. After sending HDM_LAYOUT to retrieve the size and position values, you can use the SetWindowPos function to set the new size, position, and visibility state.

Items

A header control typically has several header items that define the columns of the control. You add an item to a header control by sending the HDM_INSERTITEM message to the control. The message includes the address of an HDITEM structure. This structure defines the properties of the header item, which can include a string, a bitmapped image, an initial size, and an application-defined 32-bit value.

The fmt member of an item's HDITEM structure can include either the HDF_STRING or HDF_BITMAP flag to indicate whether the control displays the item's string or bitmap. If you want to display both a string and a bitmap, create an owner-drawn item by setting the fmt member to include the HDF_OWNERDRAW flag. The HDITEM structure also specifies formatting flags that tell the control whether to center, left-align, or right-align the string or bitmap in the item's rectangle.

HDM_INSERTITEM returns the index of the newly added item. You can use the index in other messages to set properties or retrieve information about the item. You can delete an item by using the HDM_DELETEITEM message, specifying the index of the item to delete.

You can use the HDM_SETITEM message to set the properties of an existing header item and the HDM_GETITEM message to retrieve the current properties of an item. To retrieve a count of the items in a header control, use the HDM_GETITEMCOUNT message.

Owner-Drawn Header Controls

You can define individual items of a header control to be owner-drawn items. Using this technique gives you more control than you would otherwise have over the appearance of a header item.

You can use the HDM_INSERTITEM message to insert a new owner-drawn item into a header control or the HDM_SETITEM message to change an existing item to an owner-drawn item. Both messages include the address of an HDITEM structure, which should have the fmt member set to the HDF_OWNERDRAW value.

When a header control must draw an owner-drawn item, it sends the WM_DRAWITEM message to the parent window. The wParam parameter of the message is the child window identifier of the header control, and the lParam parameter is an address of a DRAWITEMSTRUCT structure. The parent window uses the information in the structure to draw the item. For an owner-drawn item in a header control, the DRAWITEMSTRUCT structure contains the following information.

Member | Description
CtlType | ODT_HEADER owner-drawn control type.
CtlID | Child-window identifier of the header control.
itemID | Index of the item to be drawn.
itemAction | ODA_DRAWENTIRE drawing-action flag.
itemState | ODS_SELECTED drawing-action flag if the cursor is on the item and the mouse button is down. Otherwise, this member is zero.
hwndItem | Handle to the header control.
hDC | Handle to the device context of the header control.
rcItem | Coordinates of the header item to be drawn. The coordinates are relative to the upper-left corner of the header control.
itemData | Application-defined 32-bit value associated with the item.

Header Control Notification Messages

A header control sends notification messages to its parent window when the user clicks or double-clicks an item, when the user drags an item divider, and when the attributes of an item change. The parent window receives the notifications in the form of WM_NOTIFY messages. The following notifications are used with header controls.

Notification | Description
HDN_BEGINTRACK | Signals the start of divider dragging.
HDN_DIVIDERDBLCLICK | Indicates that the user double-clicked a divider.
HDN_ENDTRACK | Signals the end of divider dragging.
HDN_ITEMCHANGED | Indicates a change in the attributes of an item.
HDN_ITEMCHANGING | Indicates that the attributes of an item are about to change.
HDN_ITEMCLICK | Indicates that the user clicked an item.
HDN_ITEMDBLCLICK | Indicates that the user double-clicked an item.
HDN_TRACK | Indicates that the user dragged a divider.

Default Header Control Message Processing

This section describes the window messages handled by the window procedure for the WC_HEADER window class.

Message | Processing performed
WM_CREATE | Initializes the header control.
WM_DESTROY | Uninitializes the header control.
WM_ERASEBKGND | Fills the background of the header control using the control's current background color.
WM_GETDLGCODE | Returns a combination of the DLGC_WANTTAB and DLGC_WANTARROWS values.
WM_GETFONT | Returns the handle to the current font, which is used by the header control to draw its text.
WM_LBUTTONDBLCLK | Captures mouse input. If the mouse cursor is on a divider, the control sends the HDN_BEGINTRACK notification message and begins dragging the divider. If the cursor is on an item, the item is displayed in the pressed state.
WM_LBUTTONDOWN | Same as the WM_LBUTTONDBLCLK message.
WM_LBUTTONUP | Releases the mouse capture. If the control was tracking mouse movement, it sends the HDN_ENDTRACK notification message and redraws the header control. Otherwise, the control sends the HDN_ITEMCLICK notification message and redraws the header item that was clicked.
WM_MOUSEMOVE | If a divider is being dragged, the control sends the HDN_TRACK notification message and displays the item at the new position. If the left mouse button is down and the cursor is on an item, the item is displayed in the pressed state.
WM_NCCREATE | Allocates and initializes an internal data structure.
WM_NCDESTROY | Frees the resources allocated by the header control after the header control is uninitialized.
WM_PAINT | Paints the invalid region of the header control. If the wParam parameter is non-NULL, the control assumes that the value is an HDC and paints using that device context.
WM_SETCURSOR | Sets the cursor shape, depending on whether the cursor is on a divider or in a header item.
WM_SETFONT | Selects a new font handle into the device context for the header control.

Creating a Header Control

The following example demonstrates how to create a header control and position it along the top of the parent window's client area. The control is initially hidden. The HDM_LAYOUT message is used to calculate the size and position of the control within the parent window. The control is then repositioned and made visible.

Example

// DoCreateHeader - creates a header control that is positioned along
//     the top of the parent window's client area.
// Returns the handle to the header control.
// hwndParent - handle to the parent window.
//
// Global variable
//    g_hinst - handle to the application instance
extern HINSTANCE g_hinst;

HWND DoCreateHeader(HWND hwndParent)
{
        HWND hwndHeader;
        RECT rcParent;
        HDLAYOUT hdl;
        WINDOWPOS wp;

        // Ensure that the common control DLL is loaded, and then create
        // the header control.
        InitCommonControlsEx();

        if ((hwndHeader = CreateWindowEx(0, WC_HEADER, (LPCTSTR) NULL,
                WS_CHILD | WS_BORDER | HDS_BUTTONS | HDS_HORZ,
                0, 0, 0, 0, hwndParent, (HMENU) ID_HEADER, g_hinst,
                (LPVOID) NULL)) == NULL)
            return (HWND) NULL;

        // Retrieve the bounding rectangle of the parent window's
        // client area, and then request size and position values
        // from the header control.
        GetClientRect(hwndParent, &rcParent);

        hdl.prc = &rcParent;
        hdl.pwpos = &wp;
        if (!SendMessage(hwndHeader, HDM_LAYOUT, 0, (LPARAM) &hdl))
            return (HWND) NULL;

        // Set the size, position, and visibility of the header control.
        SetWindowPos(hwndHeader, wp.hwndInsertAfter, wp.x, wp.y,
            wp.cx, wp.cy, wp.flags | SWP_SHOWWINDOW);

        return hwndHeader;
}

Adding an Item to a Header Control

The following example demonstrates how to use the HDM_INSERTITEM message and the HDITEM structure to add an item to a header control. The new item consists of a string that is left-justified within the item rectangle.

Example

// DoInsertItem - inserts an item into a header control.
// Returns the index of the new item.
// hwndHeader - handle to the header control.
// iInsertAfter - index of the previous item.
// nWidth - width of the new item.
// lpsz - address of the item string.
int DoInsertItem(HWND hwndHeader, int iInsertAfter,
    int nWidth, LPSTR lpsz)
{
    HDITEM hdi;
    int index;

    hdi.mask = HDI_TEXT | HDI_FORMAT | HDI_WIDTH;
    hdi.pszText = lpsz;
    hdi.cxy = nWidth;
    hdi.cchTextMax = sizeof(hdi.pszText)/sizeof(hdi.pszText[0]);
    hdi.fmt = HDF_LEFT | HDF_STRING;

    index = SendMessage(hwndHeader, HDM_INSERTITEM,
        (WPARAM) iInsertAfter, (LPARAM) &hdi);

    return index;

}

Header Control Updates in Internet Explorer

Header controls in Microsoft® Internet Explorer support the following new features.

Image Lists | New messages for this feature include HDM_GETIMAGELIST and HDM_SETIMAGELIST . The header control structure HDITEM has been updated to support image lists. Image lists can be used with current bitmap support.
Callback Items | Currently, callback support includes header item text and images. Setting an HDITEM structure's text to the LPSTR_TEXTCALLBACK value or its image to the I_IMAGECALLBACK value will cause the control to send an HDN_GETDISPINFO message to request callback information as needed. HDN_GETDISPINFO is supported by the new NMHDDISPINFO structure.
Custom Item Ordering | The new messages that support this feature are: HDM_GETORDERARRAY , HDM_SETORDERARRAY , and HDM_ORDERTOINDEX .
Drag-and-Drop Manipulation | Drag-and-drop reordering of header items is now available. Implement drag-and-drop support by including the HDS_DRAGDROP style when creating the control. By default, the header control automatically handles drag-and-drop overhead and graphic effects. However, the owner of the control can manually support drag-and-drop manipulation by handling the HDN_BEGINDRAG and HDN_ENDDRAG notification messages. While handling these notifications, the owner might need to send HDM_CREATEDRAGIMAGE and HDM_SETHOTDIVIDER messages.
Hot Tracking | When this feature is enabled, the item under the pointer will be highlighted. You can check whether or not hot tracking is enabled by calling SystemParametersInfo . To enable hot tracking in a header control, create it with the HDS_HOTTRACK style.
Text, Bitmaps, and Images | Items can simultaneously display item text, a bitmap, and an image


Month Calendar Controls

A month calendar control implements a calendar-like user interface. This provides the user with a very intuitive and recognizable method of entering or selecting a date. The control also provides the application with the means to obtain and set the date information in the control using existing data types.

About Month Calendar Controls

The month calendar control is implemented in version 4.70 and later of Comctl32.dll. It provides a simple and intuitive way for a user to select a date from a familiar interface. The following illustration shows a month calendar control.

An application creates a month calendar control by calling the CreateWindowEx function and specifying MONTHCAL_CLASS as the window class. The class is registered when the month calendar class is loaded from the common controls dynamic-link library (DLL). Register this class by calling the InitCommonControlsEx function, specifying the ICC_DATE_CLASSES bit flag in the accompanying INITCOMMONCONTROLSEX structure.

Note

  • Microsoft® Windows® does not support dates prior to 1601. See FILETIME for details.
  • The month-calendar control is based on the Gregorian calendar, which was introduced in 1753. It will not calculate dates that are consistent with the Julian calendar that was in use prior to 1753.

The Month Calendar Control User Interface

The month calendar control user interface allows the user to select a date from the displayed days or change the control's display in various ways.

Scrolling the control's display

By default, when a user clicks the arrow buttons in the top left or top right of the month calendar control, the control updates its display to show the previous or next month. If the month calendar control is displaying more than one month at a time, the display changes by the number of months currently in view. That is, if the month calendar displays January, February, and March and the user clicks the top right arrow button, the control updates its display to show April, May, and June. The user can also perform the same action by clicking the partial months displayed before the first month and after the last month.

The following keyboard commands can also be used to change the current month.

PAGE UP ( VK_NEXT ) | Move to the next month.
PAGE DOWN (VK_PRIOR) | Move to the previous month.
HOME (VK_HOME) | Move to the first day of the current month.
END (VK_END) | Move to the last day of the current month.
CTRL + HOME | Move to the first visible month.
CTRL + END | Move to the last visible month.

An application can change the number of months by which the control updates its display by using the MCM_SETMONTHDELTA message or the corresponding macro, MonthCal_SetMonthDelta . However, the PAGE UP and PAGE DOWN keys change the selected month by one, regardless of the number of months displayed or the value set by MCM_SETMONTHDELTA.

Selecting a nonadjacent month

When a user clicks the name of a displayed month, a pop-up menu appears that lists all months within the year. The user can select a month on the list. If the user's selection is not visible, the month calendar control scrolls its display to show the chosen month.

Selecting a different year

If the user clicks the year displayed next to a month name, an up-down control appears in place of the year. The user can change the year with this control. The month calendar control updates its display for the selected year when the up-down control loses focus. The related keyboard commands are:

CTRL + VK_NEXT | Move to the next year.
CTRL + VK_PRIOR | Move to the previous year.

Selecting the current day

If a month calendar control is not using the MCS_NOTODAY style, the user can return to the current day by clicking the "Today" text at the bottom of the control. If the current day is not visible, the control updates its display to show it. Related keyboard commands are:

VK_LEFT | Move to the previous day.
VK_RIGHT. | Move to the next day.
VK_UP | Move to the previous week.
VK_DOWN | Move to the next week.

Day States

Month calendar controls that use the MCS_DAYSTATE style support day states. The control uses day state information to determine how it draws specific days within the control. Day state information is expressed as a 32-bit data type, MONTHDAYSTATE . Each bit in a MONTHDAYSTATE bit field (1 through 31) represents the state of a day in a month. If a bit is on, the corresponding day will be displayed in bold; otherwise, it will be displayed with no emphasis.

An application can explicitly set day state information by sending the MCM_SETDAYSTATE message or by using the corresponding macro, MonthCal_SetDayState . Additionally, month calendar controls that use the MCS_DAYSTATE style send MCN_GETDAYSTATE notification messages to request day state information. For more information on supporting day states, see Processing the MCN_GETDAYSTATE Notification Message and Preparing the MONTHDAYSTATE Array.

Month Calendar Control Styles

Month calendar controls have several styles that determine their appearance and behavior. When you create the control using CreateWindowEx , include the desired styles in the dwStyle parameter.

After creating the control, you can change all of the styles except for MCS_DAYSTATE and MCS_MULTISELECT . To change these styles, you will need to destroy the existing control and create a new one that has the desired styles. To retrieve or change any other window styles, use the GetWindowLong and SetWindowLong functions.

Month calendar controls that use the MCS_MULTISELECT style allow the user to select a range of days. By default, the control allows the user to select seven contiguous days. Your application can change the control's default behavior by using the MCM_SETMAXSELCOUNT message or the accompanying macro, MonthCal_SetMaxSelCount .

When a month calendar control uses the MCS_WEEKNUMBERS style, it displays week numbers at the left side of each month. If the MCS_NOTODAY style is applied, the control no longer circles the current day.

The MCS_DAYSTATE style is helpful when you want the control to highlight specific dates by displaying them in bold. For more information, see Day States.

Localization

The month-calendar control gets its format and all strings from LOCALE_USER_DEFAULT. For Windows 2000 and later systems, it gets the month title format from LOCALE_SYEARMONTH. Thus even with the same DLL version, the appearance of the control may vary slightly depending on the system software on which your application runs. For example, with Windows NT 4.0, the month title will look like: "September 1998". With Windows 2000, it will look like: "September, 1998".

Month Calendar Control Notification Messages

A month calendar control sends notification messages when it receives user input or must request day state information (MCS_DAYSTATE style only). The control's parent receives these notifications as WM_NOTIFY messages.

The following notification messages are used with month calendar controls.

Notification | Description
MCN_GETDAYSTATE | Requests information about which days should be displayed in bold. For more information, see Preparing the MONTHDAYSTATE Array.
MCN_SELCHANGE | Notifies the parent that the selected date or range of dates has changed. The control sends this notification when the user explicitly changes the selection within the current month, or when the selection is implicitly changed in response to next/previous month navigation.
MCN_SELECT | Notifies the parent that the user has explicitly selected a date.

Times in the Month Calendar Control

Because the month calendar control cannot be used to select a time, the time related fields of the SYSTEMTIME structure need to be handled differently. When the control is created, it will insert the current time into its "Today" date and time.

When a time is later set programmatically, the control will either copy the time fields as they are or validate them first and then, if invalid, store the current default times. Following is a list of the messages that set a date and a description of how the time fields are treated by the message.

MCM_SETCURSEL | The control will copy the time fields as they are, without validation or modification.
MCM_SETRANGE | The time fields of the structures passed in will be validated. If they are valid, the time fields will be copied without modification. If they are invalid, the control will copy the time fields from the "Today" date and time.
MCM_SETSELRANGE | The time fields of the structures passed in will be validated. If they are valid, the time fields will be copied without modification. If they are invalid, the control will retain the time fields from the current selection ranges.
MCM_SETTODAY | The control will copy the time fields as they are, without validation or modification.

When a date is retrieved from the control, the time fields will be copied from the stored times without modification. Handling of the time fields by the control is provided as a convenience to the programmer. The control does not examine or modify the time fields as a result of any operation other than those listed above.

Using Month Calendar Controls

This section provides information and sample code for implementing month calendar controls.

Creating a Month Calendar Control

To create a month calendar control, use the CreateWindowEx function, specifying MONTHCAL_CLASS as the window class. You must first register the window class by calling the InitCommonControlsEx function, specifying the ICC_DATE_CLASSES bit in the accompanying INITCOMMONCONTROLSEX structure.

The following example demonstrates how to create a month calendar control in an existing modeless dialog box. Note that the size values passed to CreateWindowEx are all zeros. Because the minimum required size depends on the font the control uses, the DoNotify example function uses the MonthCal_GetMinReqRect macro to request size information and then resizes the control by calling SetWindowPos . If you subsequently change the font with WM_SETFONT , the dimensions of the control will not change. You must call MonthCal_GetMinReqRect again and resize the control to fit the new font.

Example

//   CreateMonthCal -- Creates a month calendar control in a dialog box.
//                   Returns the handle to the month calendar control
//                   if successful, or NULL otherwise.
//
//    hwndOwner   -- Handle to the owner of the dialog box.
//    g_hinst     -- Global handle to the program instance.
//
/////
HWND WINAPI CreateMonthCal(HWND hwndOwner)
{
   HWND hwnd;
   RECT rc;
   INITCOMMONCONTROLSEX icex;

   // Load the window class.
   icex.dwSize = sizeof(icex);
   icex.dwICC  = ICC_DATE_CLASSES;
   InitCommonControlsEx(&icex);

   // Create a modeless dialog box to hold the control.
   g_hwndDlg = CreateDialog(g_hinst,
                     MAKEINTRESOURCE(IDD_DIALOG1),
                     hwndOwner,
                     DlgProc);

   // Create the month calendar.
   hwnd = CreateWindowEx(0,
                     MONTHCAL_CLASS,
                     "",
                     WS_BORDER | WS_CHILD | WS_VISIBLE | MCS_DAYSTATE,
                     0,0,0,0, // resize it later
                     g_hwndDlg,
                     NULL,
                     g_hinst,
                     NULL);

   // Get the size required to show an entire month.
   MonthCal_GetMinReqRect(hwnd, &rc);

// Arbitrary values
#define LEFT 35
#define TOP  40

   // Resize the control now that the size values have been obtained.
   SetWindowPos(hwnd, NULL, TOP, LEFT,
                LEFT + rc.right, TOP + rc.bottom,
                SWP_NOZORDER);

   // Set colors for aesthetics.
   MonthCal_SetColor(hwnd, MCSC_BACKGROUND, RGB(175,175,175));
   MonthCal_SetColor(hwnd, MCSC_MONTHBK, RGB(248,245,225));

   return(hwnd);
}

Processing the MCN_GETDAYSTATE Notification Message

Month calendar controls send the MCN_GETDAYSTATE notification message to request information about how the days within the visible months should be displayed. The following application-defined function, DoNotify, processes MCN_GETDAYSTATE by filling an array of MONTHDAYSTATE values to highlight the 15th day of each month.

DoNotify extracts the number of MONTHDAYSTATE values needed from the cDayState member of the NMDAYSTATE structure that lParam points to. The function then loops to set the 15th bit in each element of the array, using the application-defined BOLDDAY macro.

Example

BOOL WINAPI DoNotify(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
#define BOLDDAY(ds,iDay) if(iDay>0 && iDay<32)\
                            (ds)|=(0x00000001<<(iDay-1))

#define lpnmDS ((NMDAYSTATE *)lParam)
#define MAX_MONTHS 12

   MONTHDAYSTATE mds[MAX_MONTHS];
   INT i, iMax;
   LPNMHDR hdr = (LPNMHDR)lParam;

   switch(hdr->code){
      case MCN_GETDAYSTATE:
         iMax=lpnmDS->cDayState;

         for(i=0;i<iMax;i++){
            mds[i] = (MONTHDAYSTATE)0;
            BOLDDAY(mds[i],15);
         }
         lpnmDS->prgDayState = mds;
         break;
   }
   return FALSE;
}

Preparing the MONTHDAYSTATE Array

Both the MCM_SETDAYSTATE message and MCN_GETDAYSTATE notification message require an array of MONTHDAYSTATE values to determine how dates will be displayed. Each month that the control displays must have a corresponding element within the array.

To support these messages, your application must properly prepare the array. The following is a simple macro that sets a bit in a MONTHDAYSTATE value for a given day within that month.

#define BOLDDAY(ds,iDay) if(iDay>0 && iDay<32)\
                            (ds)|=(0x00000001<<(iDay-1))

Using this macro, an application can loop through an array of important dates, setting bits within the corresponding array elements. This approach is not the most efficient, of course, but works well for many purposes. As long as your application sets MONTHDAYSTATE bits appropriately, it does not matter how those bits were set.


Progress Bar Control

A progress bar is a window that an application can use to indicate the progress of a lengthy operation. It consists of a rectangle that is gradually filled with the system highlight color as an operation progresses. The following illustration shows a progress bar positioned along the bottom of a window.

  • Using Progress Bars
  • Progress Bar Control Updates in Internet Explorer

Using Progress Bars

You create a progress bar by using the CreateWindowEx function, specifying the PROGRESS_CLASS window class. This window class is registered when the common control dynamic-link library (DLL) is loaded. To ensure that this DLL is loaded, use the InitCommonControls function first.

Range and Current Position

A progress bar's range represents the entire duration of the operation, and the current position represents the progress that the application has made toward completing the operation. The window procedure uses the range and the current position to determine the percentage of the progress bar to fill with the highlight color. Because the range and current position values are expressed as unsigned integers, the highest possible range or current position value is 65,535.

The minimum value in the range can be from 0 to 65,535. Likewise, the maximum value can be from 0 to 65,535. If you do not set the range values, the system sets the minimum value to 0 and the maximum value to 100. You can adjust the range to convenient integers by using the PBM_SETRANGE message.

A progress bar provides several messages that you can use to set the current position. The PBM_SETPOS message sets the position to a given value. The PBM_DELTAPOS message advances the position by adding a specified value to the current position.

The PBM_SETSTEP message allows you to specify a step increment for a progress bar. Subsequently, whenever you send the PBM_STEPIT message to the progress bar, the current position advances by the specified increment. By default, the step increment is set to 10.

Note You use the Theme API to apply visual styles to applications. If you are using a progress bar control with the Theme API on Microsoft® Windows® XP the control must be at least 10 pixels high.

Default Progress Bar Message Processing

This section describes the messages handled by the window procedure for the PROGRESS_CLASS class.

Message | Processing performed
WM_CREATE | Allocates and initializes an initial structure.
WM_DESTROY | Frees all resources associated with the progress bar.
WM_ERASEBKGND | Draws the background and borders of the progress bar.
WM_GETFONT | Returns the handle to the current font. The progress bar does not currently draw text, so sending this message has no effect on the control.
WM_PAINT | Draws the progress bar. If the wParam parameter is non-NULL, the control assumes that the value is an HDC and paints using that device context.
WM_SETFONT | Saves the handle to the new font and returns the handle to the previous font. The progress bar does not currently draw text, so sending this message has no effect on the control.

Progress Bar Example

The following example shows how to use a progress bar to indicate the progress of a lengthy file-parsing operation. The example creates a progress bar and positions it along the bottom of the parent window's client area. The height of the progress bar is based on the height of the arrow bitmap used in a scroll bar. The range is based on the size of the file divided by 2048, which is the size of each "chunk" of data read from the file. The example also sets an increment and advances the current position of the progress bar by the increment after parsing each chunk.

Example

// ParseALargeFile - parses a large file and uses a
// progress bar to indicate the progress of the
// parsing operation.
// Returns TRUE if successful, or FALSE otherwise.
// hwndParent - parent window of the progress bar.
// lpszFileName - name of the file to parse.
//
// Global variable
//     g_hinst - instance handle

extern HINSTANCE g_hinst;

BOOL ParseALargeFile(HWND hwndParent, LPSTR lpszFileName)
{
    RECT rcClient;  // Client area of parent window
    int cyVScroll;  // Height of scroll bar arrow
    HWND hwndPB;    // Handle of progress bar
    HANDLE hFile;   // Handle of file
    DWORD cb;       // Size of file and count of
                    // bytes read
    LPCH pch;       // Address of data read from
                    // file
    LPCH pchTmp;    // Temporary pointer

    // Ensure that the common control DLL is loaded
    // and create a progress bar along the bottom of
    // the client area of the parent window.
    // Base the height of the progress bar on the
    // height of a scroll bar arrow.
    InitCommonControls();
    GetClientRect(hwndParent, &rcClient);
    cyVScroll = GetSystemMetrics(SM_CYVSCROLL);
    hwndPB = CreateWindowEx(0, PROGRESS_CLASS,
             (LPSTR) NULL, WS_CHILD | WS_VISIBLE,
             rcClient.left, rcClient.bottom
             cyVScroll, rcClient.right, cyVScroll,
             hwndParent, (HMENU) 0, g_hinst, NULL);

   // Open the file for reading, and retrieve the
   // size of the file.

    hFile = CreateFile(lpszFileName, GENERIC_READ,
            FILE_SHARE_READ, (LPSECURITY_ATTRIBUTES)
            NULL, OPEN_EXISTING,
            FILE_ATTRIBUTE_NORMAL, (HANDLE) NULL);

    if (hFile == (HANDLE) INVALID_HANDLE_VALUE)
        return FALSE;

    cb = GetFileSize(hFile, (LPDWORD) NULL);

    // Set the range and increment of the progress
    // bar.

    SendMessage(hwndPB, PBM_SETRANGE, 0,
                MAKELPARAM(0, cb / 2048));
    SendMessage(hwndPB, PBM_SETSTEP, (WPARAM) 1, 0);

    // Parse the file.
    pch = (LPCH) LocalAlloc(LPTR, sizeof(char) *
           2048);
    pchTmp = pch;
    do {
        ReadFile(hFile, pchTmp, sizeof(char) * 2048,
                 &cb,
            (LPOVERLAPPED) NULL);
        // TODO: Write an error handler to check that all the
        // requested data was read.
        .
        .
        // Include here any code that parses the
        // file.
        .
       // Advance the current position of the
       // progress bar by the increment.
       SendMessage(hwndPB, PBM_STEPIT, 0, 0);
      } while (cb);

   CloseHandle((HANDLE) hFile);
   DestroyWindow(hwndPB);

    return TRUE;
}

Progress Bar Control Updates in Internet Explorer

Progress bar controls in Microsoft Internet Explorer support the following new features.

New Progress Bar Control Styles | Progress bar controls can now display progress information vertically, using the PBS_VERTICAL style. Also, a smooth progress mode is supported using the PBS_SMOOTH style. Using the PBS_SMOOTH style causes the control to display a contiguous progress bar instead of a segmented bar.
Extended Range Values | Progress bar controls now support 32-bit range values. To set range values in excess of 65,535, use the PBM_SETRANGE32 message. To retrieve 32-bit range values, use the PBM_GETRANGE message. The progress bar high limit, low limit, and position parameters are signed integers. To make full use of the 32-bit range, set the range to -0x7FFFFFFF to 0x7FFFFFFF and treat the position as a signed integer.
Programmable Colors | An application can now control the colors used in a progress bar control with the PBM_SETBARCOLOR and PBM_SETBKCOLOR messages.


Property Sheets

A property sheet is a window that allows the user to view and edit the properties of an item. For example, a spreadsheet application can use a property sheet to allow the user to set the font and border properties of a cell or to view and set the properties of a device, such as a disk drive, printer, or mouse.

  • About Property Sheets
  • Using Property Sheets
  • Property Sheet Updates in Internet Explorer
  • Related Topics

About Property Sheets

This document assumes that you have a thorough understanding of dialog box templates and dialog box procedures. If you don't, read the "Dialog Boxes" chapter in the Platform SDK before continuing with this overview chapter.

To implement property sheets in your application, include the Prsht.h header file in your project. Prsht.h contains all of the identifiers used with property sheets.

A property sheet contains one or more overlapping child windows called pages, each containing control windows for setting a group of related properties. For example, a page can contain the controls for setting the font properties of an item, including the type style, point size, color, and so on. Each page has a tab that the user can select to bring the page to the foreground of the property sheet. For example, the Date-Time control panel application displays the following property sheet:

There is also a special type of property sheet called a wizard. Wizards are designed to present pages one at a time in a sequence that is controlled by the application. Instead of selecting from a group of pages by clicking a tab, users navigate forward and backward through the sequence, one page at a time, by clicking Next or Back buttons located at the bottom of the wizard. For example, this is the compiler wizard that sets the compiler settings in Wedit:

See Creating Wizards for a complete discussion of wizards.

Property Sheet Dialog Boxes

A property sheet and the pages it contains are actually dialog boxes. The property sheet is a system-defined dialog box that manages the pages and provides a common container for them. The property sheet dialog box can be modal or modeless. It includes a frame, a title bar, and four buttons: OK, Cancel, Apply, and Help. (The Help button may be hidden as in the preceding illustration.) The dialog box procedures for the pages receive notification messages when the user clicks the buttons.

Each page in a property sheet is an application-defined modeless dialog box that manages the control windows used to view and edit the properties of an item. You provide the dialog box template used to create each page as well as the dialog box procedure that manages the controls and sets the properties of the corresponding item.

A property sheet sends notification messages to the dialog box procedure for a page when the page is gaining or losing the activation and when the user clicks the OK, Cancel, Apply, or Help button. The notifications are sent in the form of WM_NOTIFY messages. The lParam parameter is the address of an NMHDR structure that includes the window handle to the property sheet dialog box.

Some notification messages require a page to return either TRUE or FALSE in response to the WM_NOTIFY message. To do this, the page must use the SetWindowLong function to set the DWL_MSGRESULT value for the page dialog box to either TRUE or FALSE.

Pages

A property sheet must contain at least one page, but it cannot contain more than the value of MAXPROPPAGES as defined in the Win32 header files. Each page has a zero-based index that the property sheet assigns according to the order in which the page is added to the property sheet. The indexes are used in messages that you send to the property sheet.

A property page can contain a nested dialog box. If it does, you must include the WS_EX_CONTROLPARENT style for the top-level dialog box and call the IsDialogMessage function with the handle to the parent dialog box. This ensures that the user can use mnemonics and the dialog box navigation keys to move the focus to controls in the nested dialog box.

Each page has a corresponding icon and label. The property sheet creates a tab for each page and displays the icon and label in the tab. All property sheet pages are expected to use a nonbold font. To ensure that the font is not bold, specify the DS_3DLOOK style in the dialog box template.

The dialog box procedure for a page must not call the EndDialog function. Doing so will destroy the entire property sheet, not just the page.

The minimum size for a property sheet page is 212 dialog units horizontally and 114 dialog units vertically. If a page dialog is smaller than this, the page will be enlarged until it meets the minimum size. The Prsht.h header file contains three sets of recommended sizes for property sheet pages. PROP_SM_CXDLG and PROP_SM_CYDLG define the recommended dimensions for a small property sheet page. PROP_MED_CXDLG and PROP_MED_CYDLG define the recommended dimensions for a medium-sized property sheet page. PROP_LG_CXDLG and PROP_LG_CYDLG define the recommended dimensions for a large property sheet page. Using these recommended sizes will help ensure visual consistency between your application and other Microsoft® Windows® applications.

Use the following values to set the sizes of the elements in your property sheet pages:

PROP_SM_CXDLG | Width, in dialog units, of a small property sheet page.
PROP_SM_CYDLG | Height, in dialog units, of a small property sheet page.
PROP_MED_CXDLG | Width, in dialog units, of a medium-sized property sheet page.
PROP_MED_CYDLG | Height, in dialog units, of a medium-sized property sheet page.
PROP_LG_CXDLG | Width, in dialog units, of a large property sheet page.
PROP_LG_CYDLG | Height, in dialog units, of a large property sheet page.

Property Sheet Creation

Before creating a property sheet, you must define one or more pages. This involves filling a PROPSHEETPAGE structure with information about the page—its icon, label, dialog box template, dialog box procedure, and so on—and then specifying the address of the structure in a call to the CreatePropertySheetPage function. The function returns a handle to the HPROPSHEETPAGE type that uniquely identifies the page.

To create a property sheet, you specify the address of a PROPSHEETHEADER structure in a call to the PropertySheet function. The structure defines the icon and title for the property sheet and also includes the address of an array of HPROPSHEETPAGE handles. When PropertySheet creates the property sheet, it includes the pages identified in the array. The pages appear in the property sheet in the same order that they are contained in the array.

Another way to create a property sheet is to specify an array of PROPSHEETPAGE structures instead of an array of HPROPSHEETPAGE handles. In this case, PropertySheet creates handles for the pages before adding them to the property sheet.

When a page is created, its dialog box procedure receives a WM_INITDIALOG message. The message's lParam parameter is a pointer to a copy of the PROPSHEETPAGE structure that is defined when the page is created. In particular, when a page is created, the structure's lParam member can be used to pass application-defined information to the dialog box procedure. With the exception of the lParam member, this structure must be treated as read-only. Modifying anything other than lParam will have unpredictable consequences.

When the system subsequently passes a copy of the page's PROPSHEETPAGE structure to your application, it uses the same pointer. Any changes to the structure will be passed along. Because the lParam member is ignored by the system, it can be modified to send information to other parts of your application. You can, for instance, use lParam to pass information to the page's callback function .

PropertySheet automatically sets the size and initial position of a property sheet. The position is based on the position of the owner window, and the size is based on the largest page specified in the array of pages when the property sheet was created. If you want the pages to match the width of the four buttons at the bottom of the property sheet, set the width of the widest page to 190 dialog units.

Adding and Removing Pages

After creating a property sheet, an application can add a page to the end of the existing set of pages by sending a PSM_ADDPAGE message. To insert a page between existing pages, send a PropSheet_InsertPage message. Note that the size of the property sheet cannot change after it has been created. Any added or inserted pages must be no larger than the largest page currently in the property sheet. To remove a page, send a PSM_REMOVEPAGE message.

When you define a page, you can specify the address of a PropSheetPageProc callback function that the property sheet calls when it is creating or removing the page. Using PropSheetPageProc gives you an opportunity to perform initialization and cleanup operations for individual pages.

Note A number of messages and one function call occur while the property sheet is manipulating the list of pages. While this action is taking place, attempting to modify the list of pages will have unpredictable results. Do not add, insert, or remove pages in your implementation of PropSheetPageProc, or while handling the following notifications and Windows messages.
  • PSN_APPLY
  • PSN_KILLACTIVE
  • PSN_RESET
  • PSN_SETACTIVE
  • PSN_WIZBACK
  • PSN_WIZNEXT
  • WM_INITDIALOG
  • WM_DESTROY

If the need to modify a property sheet page arises while you are handling one of these messages or while PropSheetPageProc is in operation, post yourself a private Windows message. Your application will not receive that message until after the property sheet manager has finished its tasks. It will then be safe to modify the list of pages.

When a property sheet is destroyed, it automatically destroys all of the pages that have been added to it. The pages are destroyed in reverse order from that specified in the array used to create the pages. To destroy a page that was created by the CreatePropertySheetPage function but was not added to the property sheet, use the DestroyPropertySheetPage function.

Property Sheet Title and Page Labels

You specify the title of a property sheet in the PROPSHEETHEADER structure used to create the property sheet. If the dwFlags member includes the PSH_PROPTITLE value, the property sheet adds the "Properties for" prefix to the specified title string. You can change the title after a property sheet is created by using the PSM_SETTITLE message.

By default, a property sheet uses the name string specified in the dialog box template as the label for a page. You can override the name string by including the PSP_USETITLE value in the dwFlags member of the PROPSHEETPAGE structure that defines the page. When PSP_USETITLE is specified, the pszTitle member must contain the address of the label string for the page.

Page Activation

A property sheet can have only one active page at a time. The page that has the activation is at the foreground of the overlapping stack of pages. The user activates a page by selecting its tab; an application activates a page by using the PSM_SETCURSEL message.

The property sheet sends the PSN_KILLACTIVE notification message to the page that is about to lose the activation. In response, the page must validate any changes that the user has made to the page. If the page requires additional user input before losing the activation, use the SetWindowLong function to set the DWL_MSGRESULT value of the page to TRUE. Also, the page must display a message box that describes the problem and provides the recommended action. Set DWL_MSGRESULT to FALSE when it is okay to lose the activation.

Before the page that is gaining the activation is visible, the property sheet sends the PSN_SETACTIVE notification message to the page. The page must respond by initializing its control windows.

Help Button

Property sheets can display two Help buttons: a property sheet Help button that is displayed at the bottom of the frame, next to the OK/Cancel/Apply buttons, and a standard caption bar button that provides context-sensitive Help.

The property sheet Help button is optional, and can be enabled on a page by page basis. To display the property sheet Help button for one or more pages:

  • Set the PSH_HASHELP flag in the dwFlags member of the property sheet's PROPSHEETHEADER structure.
  • For each page that will display a Help button, set the PSP_HASHELP flag in the dwFlags member of the page's PROPSHEETPAGE structure.

When the user clicks the Help button, the active page receives a PSN_HELP notification message. The page must respond by displaying Help information, typically by calling the WinHelp function.

Removing the Caption Bar Help Button

The caption bar Help button is displayed by default, so that context-sensitive Help is always available for the OK/Cancel/Apply buttons. However, this button can be removed, if necessary. To remove a property sheet's caption bar Help button:

  • For versions of the common controls prior to version 5.80 , you must implement a property sheet callback function .
  • For version 5.80 and later of the common controls, you can simply set the PSH_NOCONTEXTHELP flag in the dwFlags member of the property sheet's PROPSHEETHEADER structure. However, if you need backward compatibility with earlier common control versions, you must implement the callback function.

To implement a property sheet callback function that removes the caption bar Help button:

  • Set the PSH_USECALLBACK flag in the dwFlags member of the property sheet's PROPSHEETHEADER structure.
  • Set the pfnCallBack member of the PROPSHEETHEADER structure to point to the callback function.
  • Implement the callback function. When this function receives the PSCB_PRECREATE message, it will also receive a pointer to the property sheet's dialog box template. Remove the DS_CONTEXTHELP style from this template.

The following sample illustrates how to implement such a callback function:

Example

int CALLBACK RemoveContextHelpProc(HWND hwnd, UINT message, LPARAM lParam)
{
    switch (message)
    {
    case PSCB_PRECREATE:
        // Remove the DS_CONTEXTHELP style from the
        // dialog box template
        if (((LPDLGTEMPLATEEX)lParam)->signature ==
           0xFFFF)
           {
            ((LPDLGTEMPLATEEX)lParam)->style
            &= ~DS_CONTEXTHELP;
        }
        else {
            ((LPDLGTEMPLATE)lParam)->style
            &= ~DS_CONTEXTHELP;
        }
        return TRUE;
    }
    return TRUE;
}

If the DLGTEMPLATEEX structure is not defined, include the following declaration:

Example

#include <pshpack1.h>

typedef struct DLGTEMPLATEEX
{
    WORD dlgVer;
    WORD signature;
    DWORD helpID;
    DWORD exStyle;
    DWORD style;
    WORD cDlgItems;
    short x;
    short y;
    short cx;
    short cy;
} DLGTEMPLATEEX, *LPDLGTEMPLATEEX;

#include <poppack.h>

OK, Cancel, and Apply Buttons

The OK and Apply buttons are similar; both direct a property sheet's pages to validate and apply the property changes that the user has made. The only difference is that clicking the OK button causes the property sheet to be destroyed after the changes are applied.

When the user clicks the OK or Apply button, the property sheet sends a PSN_KILLACTIVE notification to the active page, giving it an opportunity to validate the user's changes. If the changes are valid, the page must call the SetWindowLong function with the DWL_MSGRESULT value set to FALSE. If the user's changes are not valid, the page must set DWL_MSGRESULT to TRUE and display a dialog box informing the user of the problem. The page remains active until it sets DWL_MSGRESULT to FALSE in response to a PSN_KILLACTIVE message.

After a page responds to a PSN_KILLACTIVE notification by setting DWL_MSGRESULT to FALSE, the property sheet will send a PSN_APPLY notification to each page. When a page receives this notification, it must apply the new properties to the corresponding item. To indicate to the property sheet that the changes are valid for the page, call SetWindowLong with DWL_MSGRESULT set to PSNRET_NOERROR. If the changes are invalid for the page, return an error. Doing so prevents the property sheet from being destroyed and returns focus to either the page that received the PSN_APPLY notification or the page that had focus when the Apply button was pressed. To return an error, and indicate which page will receive focus, set DWL_MSGRESULT to one of the following values.

  • PSNRET_INVALID. The property sheet will not be destroyed, and focus will be returned to this page.
  • PSNRET_INVALID_NOCHANGEPAGE. The property sheet will not be destroyed, and focus will be returned to the page that had focus when the button was pressed.

An application can use the PSM_APPLY message to simulate the selection of the Apply button.

The Apply button is initially disabled when a page becomes active, indicating that there are not yet any property changes to apply. When the page receives input through one of its controls indicating that the user has edited a property, the page must send the PSM_CHANGED message to the property sheet. The message causes the property sheet to enable the Apply button. If the user subsequently clicks the Apply or Cancel button, the page must reinitialize its controls and then send the PSM_UNCHANGED message to again disable the Apply button.

Sometimes the Apply button causes a page to make a change to a property sheet, and the change cannot be undone. When this happens, the page must send the PSM_CANCELTOCLOSE message to the property sheet. The message causes the property sheet to change the text of the OK button to "Close," indicating that the applied changes cannot be canceled.

Sometimes a page makes a change to the system configuration that requires Windows to be restarted or the system rebooted before the change can take effect. After making such a change, a page must send either the PSM_RESTARTWINDOWS or PSM_REBOOTSYSTEM message to the property sheet. These messages cause the PropertySheet function to return the ID_PSRESTARTWINDOWS or ID_PSREBOOTSYSTEM value after the property sheet is destroyed.

When a user clicks the Cancel button, the property sheet sends the PSN_RESET notification message to all pages, indicating that the property sheet is about to be destroyed. A page must use the notification to perform cleanup operations.

Using Property Sheets

This section contains examples that demonstrate how to create a property sheet and process notification messages.

Creating a Property Sheet

The example in this section creates a property sheet that contains two pages—one for setting the font properties of a cell in a spreadsheet and another for setting the border properties of the cell. The example defines the pages by filling a pair of PROPSHEETPAGE structures and specifying the address in the PROPSHEETHEADER structure that is passed to the PropertySheet function. The dialog box templates, icons, and labels for the pages are loaded from the resources contained in the application's executable file. The icon for the property sheet is also loaded from the application's resources.

Show Example

// DoPropertySheet - creates a property sheet that
// contains two pages.

// hwndOwner - handle to the owner window of the
// property sheet.
//
// Global variables
//     g_hinst - instance handle

extern HINSTANCE g_hinst;

VOID DoPropertySheet(HWND hwndOwner)
{
    PROPSHEETPAGE psp[2];
    PROPSHEETHEADER psh;
    psp[0].dwSize = sizeof(PROPSHEETPAGE);
    psp[0].dwFlags = PSP_USEICONID | PSP_USETITLE;
    psp[0].hInstance = g_hinst;
    psp[0].pszTemplate = MAKEINTRESOURCE(DLG_FONT);
    psp[0].pszIcon = MAKEINTRESOURCE(IDI_FONT);
    psp[0].pfnDlgProc = FontDialogProc;
    psp[0].pszTitle = MAKEINTRESOURCE(IDS_FONT)
    psp[0].lParam = 0;
    psp[0].pfnCallback = NULL;
    psp[1].dwSize = sizeof(PROPSHEETPAGE);
    psp[1].dwFlags = PSP_USEICONID | PSP_USETITLE;
    psp[1].hInstance = g_hinst;
    psp[1].pszTemplate =
       MAKEINTRESOURCE(DLG_BORDER);
    psp[1].pszIcon = MAKEINTRESOURCE(IDI_BORDER);
    psp[1].pfnDlgProc = BorderDialogProc;
    psp[1].pszTitle = MAKEINTRESOURCE(IDS_BORDER);
    psp[1].lParam = 0;
    psp[1].pfnCallback = NULL;
    psh.dwSize = sizeof(PROPSHEETHEADER);
    psh.dwFlags = PSH_USEICONID | PSH_PROPSHEETPAGE;
    psh.hwndParent = hwndOwner;
    psh.hInstance = g_hinst;
    psh.pszIcon =
       MAKEINTRESOURCE(IDI_CELL_PROPERTIES);
    psh.pszCaption = (LPSTR) "Cell Properties";
    psh.nPages = sizeof(psp) /
       sizeof(PROPSHEETPAGE);
    psh.nStartPage = 0;
    psh.ppsp = (LPCPROPSHEETPAGE) &psp;
    psh.pfnCallback = NULL;
    PropertySheet(&psh);
    return;
}

Processing Notification Messages

A property sheet sends WM_NOTIFY messages to retrieve information from the pages and to notify the pages of user actions. The lParam parameter of the message is the address of an NMHDR structure, which contains the handle to the property sheet dialog box, the handle to the page dialog box, and a notification code. The page must respond to some notification messages by setting the DWL_MSGRESULT value of the page to either TRUE or FALSE.

The following example is a code fragment from the dialog box procedure for a page. It shows how to process the PSN_HELP notification message.

Example

case WM_NOTIFY:
    switch (((NMHDR FAR *) lParam)->code)
    {
    case PSN_HELP:
         {
         char szBuf[FILE_LEN]; // Buffer for
                               // name of Help file
         // Display Help for the font properties
         // page.

         LoadString(g_hinst, IDS_HELPFILE, &szBuf,
         sizeof(szBuf)/sizeof(szBuf[0]));

         WinHelp(((NMHDR FAR *) lParam)->hwndFrom,
         &szBuf, HELP_CONTEXT, IDH_FONT_PROPERTIES);
         break;
         }
        .
        . // Process other property sheet
          // notifications here.
        .
    }

Property Sheet Updates in Internet Explorer

Property sheets in Microsoft® Internet Explorer support the following new features.

New Notification | The PSN_GETOBJECT notification has been added to allow a page to be an OLE drop target.
Updated Structures | The PROPSHEETHEADER and PROPSHEETPAGE structures have been updated to support new features. See the references for these structures for more information.


About Rich Edit Controls

The original specification for rich edit controls is Microsoft® Rich Edit 1.0; the current specification is Rich Edit 4.1. Each version of rich edit is a superset of the preceding one, except that only Asian builds of Rich Edit 1.0 have a vertical text option.

Creating a Rich Edit Control

To create a rich edit control, call the CreateWindowEx function, specifying the rich edit window class. If you are using Rich Edit 1.0 (Riched32.dll), specify RichEdit for the window class parameter. If you are using Rich Edit 2.0 or later (Riched20.dll), specify RICHEDIT_CLASS for the window class parameter.

Rich edit controls support most of the window styles used with edit controls as well as additional styles. You should specify the ES_MULTILINE window style if you want to allow more than one line of text in the control.

Note To use visual styles with these controls, an application must include a manifest and must call InitCommonControls at the beginning of the program. For information on visual styles, see Visual Styles . For information on manifests, see Using Windows XP Visual Styles .

Text Formatting

An application can send messages to a rich edit control to format characters and paragraphs to retrieve formatting information. Paragraph formatting attributes include alignment, tabs, indents, numbering, and simple tables. For characters, you can specify font name, size, color, and effects such as bold, italic, and protected.

You can apply paragraph formatting by using the EM_SETPARAFORMAT message. To determine the current paragraph formatting for the selected text, use the EM_GETPARAFORMAT message. The PARAFORMAT or PARAFORMAT2 structure is used with both messages to specify paragraph formatting attributes.

You can apply character formatting by using the EM_SETCHARFORMAT message. To determine the current character formatting for the selected text, you can use the EM_GETCHARFORMAT message. The CHARFORMAT or CHARFORMAT2 structure is used with both messages to specify character attributes.

You can also use EM_SETCHARFORMAT and EM_GETCHARFORMAT messages to set and retrieve the character formatting of the insertion point, which is the formatting applied to any subsequently inserted characters. For example, if an application sets the default character formatting to bold and the user then types a character, that character is bold.

The character formatting of the insertion point is applied to newly inserted text only if the current selection is empty (if the current selection is an insertion point). Otherwise, the new text assumes the character formatting of the text it replaces. If the selection changes, the default character formatting changes to match the first character in the new selection.

The protected character effect is unique in that it does not change the appearance of text. If the user attempts to modify protected text, a rich edit control sends its parent window an EN_PROTECTED notification message, allowing the parent window to allow or prevent the change. To receive this notification message, you must enable it by using the EM_SETEVENTMASK message.

Foreground color is always a character attribute. In Rich Edit 1.0, background color is only a property of the rich edit control. To set the default background color, use the EM_SETBKGNDCOLOR message. Note, Rich Edit does not support the WM_CTLCOLOREDIT message.

Current Selection in a Rich Edit Control

The user can select text in a rich edit control by using the mouse or the keyboard. The current selection is the range of selected characters, or the position of the insertion point if no characters are selected. An application can get information about the current selection, set it, determine when it changes, and show or hide the selection highlight.

To determine the current selection in a rich edit control, use the EM_EXGETSEL message. To set the current selection, use the EM_EXSETSEL message. The CHARRANGE structure is used with both messages and specifies a range of characters. To retrieve information about the contents of the current selection, you can use the EM_SELECTIONTYPE message.

An application can detect when the current selection changes by processing the EN_SELCHANGE notification message. The notification message specifies a SELCHANGE structure containing information about the new selection. A rich edit control sends this notification message only if you enable it by using the EM_SETEVENTMASK message.

By default, a rich edit control shows and hides the selection highlight when it gains and loses the focus. You can show or hide the selection highlight at any time by using the EM_HIDESELECTION message. For example, an application might provide a Search dialog box to find text in a rich edit control. The application might select matching text without closing the dialog box, in which case it must use the EM_HIDESELECTION message to highlight the selection.

As with edit controls, you can specify the ES_NOHIDESEL window style to prevent a rich edit control from hiding the selection highlight when it loses the focus.

As an alternative to using the EM_EXGETSEL and EM_EXSETSEL messages, you can retrieve and set the current selection by using the EM_GETSEL and EM_SETSEL edit control messages. The EM_GETSEL message packs two 16-bit character indexes into its 32-bit return value and therefore, works only for selections that fall entirely within the first 64K. However, a rich edit control will never contain more than 32K characters of text, unless you extend this limit by using the EM_LIMITTEXT or EM_EXLIMITTEXT message. For selections that extend beyond the first 64KB of text, the EM_GETSEL message returns – 1. In such a case you can still use the values returned in wParam and lParam to find the start and end characters of the selection.

Rich Edit Text Operations

An application can send messages to retrieve or find text in a rich edit control. You can retrieve either the selected text or a specified range of text.

To get the selected text in a rich edit control, use the EM_GETSELTEXT message. The text is copied to the specified character array. You must ensure that the array is large enough to hold the selected text plus a terminating null character.

To retrieve a specified range of text, use the EM_GETTEXTRANGE message. The TEXTRANGE structure used with this message specifies the text range to retrieve and points to a character array that receives the text. Here again, the application must ensure that the array is large enough for the specified text plus a terminating null character.

You can search for a string in a rich edit control by using the EM_FINDTEXT message. The FINDTEXT structure used with this message specifies the text range to search and the string to search for. You can also specify such options as whether the search is case sensitive.

Rich Edit 3.0 also supports the HexToUnicode IME, which allows a user to convert between hexadecimal and Unicode by using hot keys. For more information, see HexToUnicode IME .

Word and Line Breaks

A rich edit control calls a function called a word-break procedure to find breaks between words and to determine where it can break lines. The control uses this information when performing word-wrap operations and when processing CTRL+LEFT ARROW key and CTRL+RIGHT ARROW key combinations. An application can send messages to a rich edit control to replace the default word-break procedure, to retrieve word-break information, and to determine what line a given character falls on.

Word-break procedures for rich edit controls are similar to those for edit controls, but they have additional capabilities: word-break procedures for both kinds of controls can determine whether a character is a delimiter and can find the nearest word break before or after the specified position. A delimiter is a character that marks the end of a word, such as a space. Usually, in an edit control, a word break occurs only after delimiters. However, different rules apply to most Asian languages.

Word-break procedures for rich edit controls also group characters into character classes, each identified by a value in the range 0x00 through 0x0F. Breaks occur either after delimiters or between characters of different classes. Thus, a word-break procedure with different classes for alphanumeric and punctuation characters would find two word breaks in the string "Win.doc" (before and after the period).

A character's class can be combined with zero or more word-break flags to form an 8-bit value. When performing word-wrap operations, a rich edit control uses word-break flags to determine where it can break lines. Rich Edit uses the following word-break flags.

Flags | Description
WBF_BREAKAFTER | Lines may be broken after the character.
WBF_BREAKLINE | The character is a delimiter. Delimiters mark the ends of words. Lines may be broken after delimiters.
WBF_ISWHITE | The character is a white-space character. Trailing white-space characters are not included in the length of a line when wrapping.

The WBF_BREAKAFTER value is used to allow wrapping after a character that does not mark the end of a word, such as a hyphen.

You can replace the default word-break procedure for a rich edit control, with your own procedure by using the EM_SETWORDBREAKPROC message. For more information about word-break procedures, see the description of the EditWordBreakProc function.

Note This replacement is not recommended for Rich Edit control 2.0 and later, due to the complexity of multilingual word breaking.

For Rich Edit 1.0, you can use the EM_SETWORDBREAKPROCEX message to replace the default extended word-break procedure with an EditWordBreakProcEx function. This function provides additional information about the text, such as the character set. You can use the EM_GETWORDBREAKPROCEX message to retrieve the address of the current extended word-break procedure. Note that Rich Edit 2.0 and later do not support EditWordBreakProcEx, EM_GETWORDBREAKPROCEX, and EM_SETWORDBREAKPROCEX.

You can use the EM_FINDWORDBREAK message to find word breaks or to determine a character's class and word-break flags. In turn, the control calls its word-break procedure to get the requested information.

To determine which line a given character falls on, you can use the EM_EXLINEFROMCHAR message.

Rich Edit Clipboard Operations

An application can paste the contents of the clipboard into a rich edit control using either the best available clipboard format or a specific clipboard format. You can also determine whether a rich edit control is capable of pasting a clipboard format.

As with an edit control, you can copy or cut the contents of the current selection by using the WM_COPY or WM_CUT message. Similarly, you can paste the contents of the clipboard into a rich edit control by using the WM_PASTE message. The control pastes the first available format that it recognizes, which presumably is the most descriptive format.

To paste a specific clipboard format, you can use the EM_PASTESPECIAL message. This message is useful for applications with a Paste Special command that enables the user to select the clipboard format. You can use the EM_CANPASTE message to determine whether a given format is recognized by the control.

You can also use the EM_CANPASTE message to determine whether any available clipboard format is recognized by a rich edit control. This message is useful when processing the WM_INITMENUPOPUP message. An application might enable or gray its Paste command depending on whether the control can paste any available format.

Rich edit controls register two clipboard formats:

  • RTF
  • RichEdit Text and Objects

An application can register these formats by using the RegisterClipboardFormat function, specifying the CF_RTF and CF_RETEXTOBJ values.

Streams

You can use streams to transfer data into or out of a rich edit control. A stream is defined by an EDITSTREAM structure, which specifies a buffer and an application defined–callback function.

To read data into a rich edit control (that is, stream in the data), use the EM_STREAMIN message. The control repeatedly calls the application's callback function, which transfers a portion of the data into the buffer each time.

To save the contents of a rich edit control (that is, stream out the data), you can use the EM_STREAMOUT message. The control repeatedly writes to the buffer and then calls the application's callback function. For each call, the callback function saves the contents of the buffer.

Printing

You can send messages to a rich edit control to render its output for a specified device, such as a printer. You can also specify the output device for which a rich edit control formats its text.

To format part of a rich edit control's contents for a specific device, you can use the EM_FORMATRANGE message. The FORMATRANGE structure used with this message specifies the range of text to format as well as the device context for the target device.

After formatting text for an output device, you can send the output to the device by using the EM_DISPLAYBAND message. By repeatedly using the EM_FORMATRANGE and EM_DISPLAYBAND messages, an application that prints the contents of a rich edit control can implement banding. (Banding is the division of output into smaller parts for printing purposes.)

You can use the EM_SETTARGETDEVICE message to specify the target device for which a rich edit control formats its text. This message is useful for WYSIWYG formatting, in which an application positions text using the default printer's font metrics instead of the screen's.

Bottomless Rich Edit Controls

An application can resize a rich edit control as needed so that it is always the same size as its contents. A rich edit control supports this so-called bottomless functionality by sending its parent window an EN_REQUESTRESIZE notification message whenever the size of its content changes.

When processing the EN_REQUESTRESIZE notification message, an application should resize the control to the dimensions in the specified REQRESIZE structure. An application might also move any information near the control to accommodate the control's change in height. To resize the control, you can use the SetWindowPos function.

You can force a bottomless rich edit control to send an EN_REQUESTRESIZE notification message by using the EM_REQUESTRESIZE message. This message can be useful when processing the WM_SIZE message.

To receive EN_REQUESTRESIZE notification messages, you must enable the notification by using the EM_SETEVENTMASK message.

Miscellaneous Notification Messages

A rich edit control's parent window can process notification messages to monitor events affecting the control. Rich edit controls support all of the notification messages used with edit controls as well as several additional ones. You can determine which notification messages a rich edit control sends its parent window by setting its event mask.

To set the event mask for a rich edit control, use the EM_SETEVENTMASK message. You can retrieve the current event mask for a rich edit control by using the EM_GETEVENTMASK message. For a list of event mask flags, see Rich Edit Control Event Mask Flags .

A rich edit control's parent window can filter all keyboard and mouse input to the control by processing the EN_MSGFILTER notification message. The parent window can prevent the keyboard or mouse message from being processed or can change the message by modifying the specified MSGFILTER structure.

An application can process the EN_PROTECTED notification message to detect when the user attempts to modify protected text. To mark a range of text as protected, you can set the protected character effect. For more information, see Text Formatting.

You can enable the user to drop files in a rich edit control by processing the EN_DROPFILES notification message. The specified ENDROPFILES structure contains information about the files being dropped.

Font Binding

Rich Edit 3.0 will assign a charset to plain-text characters depending on their context. Some examples are:

  • Hangul symbols get HANGUL_CHARSET
  • Non-neutral ANSI characters get ANSI_CHARSET in any event
  • Chinese characters get SHIFTJIS_CHARSET if kana characters are found nearby or GB2312_CHARSET if no kana are found nearby.
  • Greek characters get GREEK_CHARSET
Note The Rich Edit control uses Unicode internally, so this use of charset differs from the original one used in font specifications. But CHARFORMAT has a well-defined place for the charset.

Neutral characters like blanks and digits are assigned a charset depending on their context. For example, a blank surrounded by characters of the same charset gets that charset. Neutrals and digits used for bidirectional text are assigned charsets in a way based on the Unicode bidirectional algorithm.

Once charsets are assigned, Rich Edit scans the text around the insertion point forward and backward to find the nearest fonts that have been used for the charsets. If no font is found for a charset, rich edit uses the font chosen by the client for that charset. If the client hasn't specified a font for the charset, rich edit uses the default font for that charset. If the client wants some other font, the client can always change it, but this approach will work most of the time. The current default font choices are based on the following table. Note that the default fonts are set per-process, and there are separate lists for UI usage and for non-UI usage.

Language | UI font name | UI font size | non-UI font name | non-UI font size
Western, CE, ME, Vietnamese | Tahoma | 8 | Arial | 10
Japanese | MS UI Gothic | 9 | MS P Gothic | 10
Korean | Gulim | 9 | Gulim | 9
Simplified Chinese | Simsun | 9 | SimSun | 10
Traditional Chinese | PMingLiU | 9 | PMingLiU | 9
Thai | MS Sans Serif | 8 | Tahoma | 14
Symbols | Wingdings | 8 | Wingdings | 10
Devanagari | Mangal | 8 | Mangal | 10
Tamil | Latha | 8 | Latha | 10
Georgian, Armenian | Arial Unicode | 8 | Arial Unicode | 10

Therefore, in the default font-binding table (entries have charset, font name, size), Rich Edit allows ANSI_CHARSET to match several charsets, while the appropriate charset matches other fonts on a one-to-one basis. More precisely, rich edit uses the ANSI_CHARSET choice whenever no other alternative is found. You will be able to specify a finer granularity than this, for example: assign a specific ARABIC_CHARSET for Arabic runs, a specific Greek font for Greek runs, for example. This finer granularity will also be used if a font with the desired charset stamp is found somewhere in the document before the area being font-bound.

Note that Rich Edit does not currently handle a missing glyph in a font that claims to support a charset but is incomplete. At display time in a complex script, Rich Edit does end up knowing that such a glyph is missing, but it does not cause the backing store to use a new font. Normally, the underlying font linking of the OS will accomplish this.

Rich Edit 4.1: To set the default font for a script, call EM_SETCHARFORMAT with CHARFORMAT2, specifying yHeight, bCharSet, bPitchAndFamily, szFaceName, and lcid. Also, to get the default font for a specific code page, call EM_GETCHARFORMAT with CHARFORMAT2 specifying bCharSet and lcid.

Unsupported Edit Control Functionality

Rich edit controls support most but not all functionality for multiline edit controls. This section lists the edit control messages and window styles that are not supported by rich edit controls.

The following messages are processed by edit controls but not by rich edit controls.

Unsupported message | Comments
EM_FMTLINES | Not supported.
EM_GETHANDLE | Rich edit controls do not store text as a simple array of characters.
EM_GETIMESTATUS | Not supported.
EM_GETMARGINS | Not supported.
EM_SETHANDLE | Rich edit controls do not store text as a simple array of characters.
EM_SETIMESTATUS | Not supported.
EM_SETMARGINS | Supported in Rich Edit 3.0.
EM_SETRECTNP | Not supported.
EM_SETTABSTOPS | The EM_SETPARAFORMAT message is used instead. Supported in Rich Edit 3.0.
WM_CTLCOLOR | The EM_SETBKGNDCOLOR message is used instead.
WM_GETFONT | The EM_GETCHARFORMAT message is used instead.

The following window styles are used with multiline edit controls but not with rich edit controls: ES_LOWERCASE, ES_UPPERCASE, and ES_OEMCONVERT.

Rich Edit Shortcut Keys

Rich edit controls support the following shortcut keys.

Keys | Operations | Comments
Shift+Backspace | Generate a LRM/LRM on a bidi keyboard | BiDi specific
Ctrl+Tab | Tab |
Ctrl+Clear | Select all |
Ctrl+Number Pad 5 | Select all |
Ctrl+A | Select all |
Ctrl+E | Center alignment |
Ctrl+J | Justify alignment |
Ctrl+R | Right alignment |
Ctrl+L | Left alignment |
Ctrl+C | Copy |
Ctrl+V | Paste |
Ctrl+X | Cut |
Ctrl+Z | Undo |
Ctrl+Y | Redo |
Ctrl+'+' (Ctrl+Shift+'=') | Superscript |
Ctrl+'=' | Subscript |
Ctrl+1 | Line spacing = 1 line. |
Ctrl+2 | Line spacing = 2 lines. |
Ctrl+5 | Line spacing = 1.5 lines. |
Ctrl+' (apostrophe) | Accent acute | After pressing the short cut key, press the appropriate letter (for example a, e, or u). This applies to English, French, German, Italian, and Spanish keyboards only.
Ctrl+` (grave) | Accent grave | See Ctrl+' comments.
Ctrl+~ (tilde) | Accent tilde | See Ctrl+' comments.
Ctrl+; (semicolon) | Accent umlaut | See Ctrl+' comments.
Ctrl+Shift+6 | Accent caret (circumflex) | See Ctrl+' comments.
Ctrl+, (comma) | Accent cedilla | See Ctrl+' comments.
Ctrl+Shift+' (apostrophe) | Activate smart quotes |
Backspace | If text is protected, beep and do not delete it. Otherwise, delete previous character. |
Ctrl+Backspace | Delete previous word. This generates a VK_F16 code. |
F16 | Same as Backspace. |
Ctrl+Insert | Copy |
Shift+Insert | Paste |
Insert | Overwrite | DBCS does not overwrite.
Ctrl+Left Arrow | Move cursor one word to the left. | On bidi keyboard, this depends on the direction of the text.
Ctrl+Right Arrow | Move cursor one word to the right. | See Ctrl+Left Arrow comments.
Ctrl+Left Shift | Left alignment | In BiDi documents, this is for left-to-right reading order.
Ctrl+Right Shift | Right alignment | In BiDi documents, this is for right-to-left reading order.
Ctrl+Up Arrow | Move to the line above. |
Ctrl+Down Arrow | Move to the line below. |
Ctrl+Home | Move to the beginning of the document. |
Ctrl+End | Move to the end of the document. |
Ctrl+Page Up | Move one page up. | If in SystemEditMode and Single Line control, do nothing.
Ctrl+Page Down | Move one page down. | See Ctrl+Page Up comments.
Ctrl+Delete | Delete the next word or selected characters. |
Shift+Delete | Cut the selected characters. |
Esc | Stop drag-drop. | While doing a drag-drop of text.
Alt+Esc | Change the active application. |
Alt+X | Converts the Unicode hexadecimal value preceding the insertion point to the corresponding Unicode character. |
Alt+Shift+X | Converts the Unicode character preceding the insertion point to the corresponding Unicode hexadecimal value. |
Alt+0xxx (Number Pad) | Inserts Unicode values if xxx is greater than 255. When xxx is less than 256, ASCI range text is inserted based on the current keyboard. | Must enter decimal values.
Alt+Shift+Ctrl+F12 | Hex to Unicode. | In case Alt+X is already taken for another use.
Alt+Shift+Ctrl+F11 | Selected text will be output to the debugger window and saved to %temp%\DumpFontInfo.txt. | For Debug only (need to set Flag=8 in Win.ini)
Ctrl+Shift+A | Set all caps. |
Ctrl+Shift+L | Fiddle bullet style. |
Ctrl+Shift+Right Arrow | Increase font size. | Font size changes by 1 point in the range 4pt-11pt; by 2points for 12pt-28pt; it changes from 28pt -> 36pt -> 48pt -> 72pt -> 80pt; it changes by 10 points in the range 80pt - 1630pt; the maximum value is 1638.
Ctrl+Shift+Left Arrow | Decrease font size. | See Ctrl+Shift+Right Arrow comments.


About Scroll Bars

A window can display a data object, such as a document or a bitmap, that is larger than the window's client area. When provided with a scroll bar, the user can scroll a data object in the client area to bring into view the portions of the object that extend beyond the borders of the window.

Microsoft® Internet Explorer 4.0 introduces a new control called a flat scroll bar. Functionally, flat scroll bars behave just like standard scroll bars. The difference is that you can customize the appearance of flat scroll bars to a greater extent than standard scroll bars.

Scroll bars should be included in any window for which the content of the client area extends beyond the window's borders. A scroll bar's orientation determines the direction in which scrolling occurs when the user operates the scroll bar. A horizontal scroll bar enables the user to scroll the content of a window to the left or right. A vertical scroll bar enables the user to scroll the content up or down.

The following topics are discussed in this section.

  • Parts of a Scroll Bar
  • Standard Scroll Bars and Scroll Bar Controls
  • Scroll Box Position and Scrolling Range
  • Scroll Bar Visibility
  • Scroll Bar Requests
  • Keyboard Interface for a Scroll Bar
  • Scrolling the Client Area
  • Scroll Bar Colors and Metrics

Parts of a Scroll Bar

A scroll bar consists of a shaded shaft with an arrow button at each end and a scroll box (sometimes called a thumb) between the arrow buttons. A scroll bar represents the overall length or width of a data object in a window's client area; the scroll box represents the portion of the object that is visible in the client area. The position of the scroll box changes whenever the user scrolls a data object to display a different portion of it. The system also adjusts the size of a scroll bar's scroll box so that it indicates what portion of the entire data object is currently visible in the window. If most of the object is visible, the scroll box occupies most of the scroll bar's shaft. Similarly, if only a small portion of the object is visible, the scroll box occupies a small part of the shaft.

The user scrolls the content of a window by clicking one of the arrow buttons, by clicking the area in the shaded shaft, or by dragging the scroll box. When the user clicks an arrow button, the application scrolls the content by one unit (typically a single line or column). When the user clicks the shaded areas, the application scrolls the content by one window. The amount of scrolling that occurs when the user drags the scroll box depends on the distance the user drags the scroll box and on the scrolling range of the scroll bar. For more information about the scrolling range, see Scroll Box Position and Scrolling Range.

Standard Scroll Bars and Scroll Bar Controls

A scroll bar is included in a window either as a standard scroll bar or as a scroll bar control. A standard scroll bar is located in the nonclient area of a window. It is created with the window and displayed when the window is displayed. The sole purpose of a standard scroll bar is to enable the user to generate scrolling requests for viewing the entire content of the client area. You can include a standard scroll bar in a window by specifying WS_HSCROLL, WS_VSCROLL, or both styles when you create the window. The WS_HSCROLL style creates a horizontal scroll bar positioned at the bottom of the client area. The WS_VSCROLL style creates a vertical scroll bar positioned at the right of the client area. The SM_CXHSCROLL and SM_CYHSCROLL system metric values define the width and height of a standard horizontal scroll bar. The SM_CXVSCROLL and SM_CYVSCROLL values define the width and height of a standard vertical scroll bar. A standard scroll bar is part of its associated window and therefore does not have a window handle of its own.

A scroll bar control is a control window that belongs to the SCROLLBAR window class. A scroll bar control appears and functions like a standard scroll bar, but it is a separate window. As a separate window, a scroll bar control receives direct input focus, indicated by a flashing caret displayed in the scroll box. Unlike a standard scroll bar, a scroll bar control also has a built-in keyboard interface that enables the user to direct scrolling. You can use as many scroll bar controls as needed in a single window. When you create a scroll bar control, you must specify the scroll bar's size and position. However, if a scroll bar control's window can be resized, adjustments to the scroll bar's size must be made whenever the size of the window changes.

The advantage of using a standard scroll bar is that the system creates the scroll bar and automatically sets its size and position. However, standard scroll bars are sometimes too restrictive. For example, suppose that you want to divide a client area into quadrants and use a separate set of scroll bars to control the content of each quadrant. You cannot use standard scroll bars because you can only create one set of scroll bars for a particular window. Use scroll bar controls instead, because you can add as many of them to a window as you want.

Applications can provide scroll bar controls for purposes other than scrolling the content of a window. For example, a screen saver application might provide a scroll bar for setting the speed at which graphics are moved about on the screen.

A scroll bar control can have a number of styles that serves to control the orientation and position of the scroll bar. You specify the styles that you want when you call the CreateWindowEx function to create a scroll bar control. Some of the styles create a scroll bar control that uses a default width or height. However, you must always specify the x- and y-coordinates and the other dimensions of the scroll bar.

For a table of scroll bar control styles, see Scroll Bar Control Styles .

Note To use visual styles with scroll bars, an application must include a manifest and must call InitCommonControls at the beginning of the program. For information on visual styles, see Visual Styles . For information on manifests, see Using Windows XP Visual Styles .

Scroll Box Position and Scrolling Range

The position of the scroll box is represented as an integer; it is relative to the left or upper end of the scroll bar, depending on whether the scroll bar is horizontal or vertical. The position must be within the minimum and maximum values of the scrolling range. For example, in a scroll bar with a range of 0 through 100, position 50 is in the middle, with the remaining positions distributed equally along the scroll bar. The initial range depends on the scroll bar. Standard scroll bars have an initial range of 0 through 100; scroll bar controls have an empty range (both minimum and maximum values are zero), unless you supply an explicit range when the control is created. You can change the range at any time. You can use the SetScrollInfo function to set the range values, and the GetScrollInfo function to retrieve the current range values.

An application typically adjusts the scroll range to convenient integers, making it easy to translate the scroll box position into a value corresponding to the data object to be scrolled. For example, if an application must display 260 lines of a text file in a window that can show only 16 lines at a time, the vertical scroll bar range can be set to 1 through 244. If the scroll box is at position 1, the first line will be at the top of the window. If the scroll box is at position 244, the last line (line 260) will be at the bottom of the window. If an application attempts to specify a position value that is less than the minimum or more than the maximum, the minimum or maximum scrolling range value is used instead.

You can set a page size for a scroll bar. The page size represents the number of data units that can fit in the client area of the owner window given its current size. For example, if the client area can hold 16 lines of text, an application would set the page size to 16. The system uses the page size, along with the scrolling range and length of the scroll shaft, to set the size of the scroll box. Whenever a window containing a scroll bar is resized, an application should call the SetScrollInfo function to set the page size. An application can retrieve the current page size by calling the sending GetScrollInfo function.

To establish a useful relationship between the scroll bar range and the data object, an application must adjust the range whenever the size of the data object changes.

As the user moves the scroll box in a scroll bar, the scroll bar reports the scroll box position as an integer in the scrolling range. If the position is the minimum value, the scroll box is at the top of a vertical scroll bar or at the left end of a horizontal scroll bar. If the position is the maximum value, the scroll box is at the bottom of a vertical scroll bar or at right end of a horizontal scroll bar.

The maximum value that a scroll bar can report (that is, the maximum scrolling position) depends on the page size. If the scroll bar has a page size greater than one, the maximum scrolling position is less than the maximum range value. You can use the following formula to calculate the maximum scrolling position:

MaxScrollPos = MaxRangeValue - (PageSize - 1)

An application must move the scroll box in a scroll bar. Although the user makes a request for scrolling in a scroll bar, the scroll bar does not automatically update the scroll box position. Instead, it passes the request to the parent window, which must scroll the data and update the scroll box position. An application uses the SetScrollInfo function to update the scroll box position; otherwise, it uses the SetScrollPos function. Because it controls the scroll box movement, the application can move the scroll box in increments that work best for the data being scrolled.

Scroll Bar Visibility

The system hides and disables a standard scroll bar when equal minimum and maximum values are specified. The system also hides and disables a standard scroll bar if you specify a page size that includes the entire scroll range of the scroll bar. This is the way to temporarily hide a scroll bar when it is not needed for the content of the client area. There is no need to make scrolling requests through the scroll bar when it is hidden. The system enables the scroll bar and shows it again when you set the minimum and maximum values to unequal values or when the page size that does not include the entire scroll range. The ShowScrollBar function can also be used to hide or show a scroll bar. It does not affect the scroll bar's range, page size, or scroll box position.

The EnableScrollBar function can be used to disable one or both arrows of a scroll bar. An application displays disabled arrows in gray and does not respond to user input.

Scroll Bar Requests

The user makes scrolling requests by clicking various parts of a scroll bar. The system sends the request to the specified window in the form of a WM_HSCROLL or WM_VSCROLL message. A horizontal scroll bar sends the WM_HSCROLL message; a vertical scroll bar sends the WM_VSCROLL message. Each message includes a request code that corresponds to the user's action, to the handle to the scroll bar (scroll bar controls only), and, in some cases, to the position of the scroll box.

The following figure shows the request code that the user generates when clicking various parts of a scroll bar.

The SB_ values specify the action the user takes. An application examines the codes that accompany the WM_HSCROLL and WM_VSCROLL messages and then performs the appropriate scrolling operation. In the following table, the user's action is specified for each value, followed by the application's response. In each case, a unit is defined by the application as appropriate for the data. For example, the typical unit for scrolling text vertically is a line of text.

Request | Action | Response
SB_LINEUP | The user clicks the top scroll arrow. | Decrements the scroll box position; scrolls toward the top of the data by one unit.
SB_LINEDOWN | The user clicks the bottom scroll arrow. | Increments the scroll box position; scrolls toward the bottom of the data by one unit.
SB_LINELEFT | The user clicks the left scroll arrow. | Decrements the scroll box position; scrolls toward the left end of the data by one unit.
SB_LINERIGHT | The user clicks the right scroll arrow. | Increments the scroll box position; scrolls toward the right end of the data by one unit.
SB_PAGEUP | The user clicks the scroll bar shaft above the scroll box. | Decrements the scroll box position by the number of data units in the window; scrolls toward the top of the data by the same number of units.
SB_PAGEDOWN | The user clicks the scroll bar shaft below the scroll box. | Increments the scroll box position by the number of data units in the window; scrolls toward the bottom of the data by the same number of units.
SB_PAGELEFT | The user clicks the scroll bar shaft to the left of the scroll box. | Decrements the scroll box position by the number of data units in the window; scrolls toward the left end of the data by the same number of units.
SB_PAGERIGHT | The user clicks the scroll bar shaft to the right of the scroll box. | Increments the scroll box position by the number of data units in the window; scrolls toward the right end of the data by the same number of units.
SB_THUMBPOSITION | The user releases the scroll box after dragging it. | Sets the scroll box to the position specified in the message; scrolls the data by the same number of units the scroll box has moved.
SB_THUMBTRACK | The user drags the scroll box. | Sets the scroll box to the position specified in the message and scrolls the data by the same number of units the scroll box has moved for applications that draw data quickly. Applications that cannot draw data quickly must wait for the SB_THUMBPOSITION request code before moving the scroll box and scrolling the data.
SB_ENDSCROLL | The user releases the mouse after holding it on an arrow or in the scroll bar shaft. | No response is needed.

A scroll bar generates SB_THUMBPOSITION and SB_THUMBTRACK request code when the user clicks and drags the scroll box. An application should be programmed to process either the SB_THUMBTRACK or SB_THUMBPOSITION request code.

The SB_THUMBPOSITION request code occurs when the user releases the mouse button after clicking the scroll box. An application that processes this message performs the scrolling operation after the user has dragged the scroll box to the desired position and released the mouse button.

The SB_THUMBTRACK request code occurs as the user drags the scroll box. If an application processes SB_THUMBTRACK request codes, it can scroll the content of a window as the user drags the scroll box. However, a scroll bar can generate many SB_THUMBTRACK request code in a short period, so an application should process these request codes only if it can quickly repaint the content of the window.

Keyboard Interface for a Scroll Bar

A scroll bar control provides a built-in keyboard interface that enables the user to issue scrolling requests by using the keyboard; a standard scroll bar does not. When a scroll bar control has the keyboard focus, it sends WM_HSCROLL and WM_VSCROLL messages to its parent window when the user presses the arrow keys. The request code is sent with each message corresponding to the arrow key the user has pressed. Following are the arrow keys and their corresponding request codes.

Arrow key | Request code
DOWN | SB_LINEDOWN or SB_LINERIGHT
END | SB_BOTTOM
HOME | SB_TOP
LEFT | SB_LINEUP or SB_LINELEFT
PGDN | SB_PAGEDOWN or SB_PAGERIGHT
PGUP | SB_PAGEUP or SB_PAGELEFT
RIGHT | SB_LINEDOWN or SB_LINERIGHT
UP | SB_LINEUP or SB_LINELEFT
Note The keyboard interface of a scroll bar control sends the SB_TOP and SB_BOTTOM request codes. The SB_TOP request code indicates that the user has reached the top value of the scrolling range. An application scrolls the window content downward so that the top of the data object is visible. The SB_BOTTOM request code indicates that the user has reached the bottom value of the scrolling range. If an application processes the SB_BOTTOM request code, it scrolls the window content upward so that the bottom of the data object is visible.

If you want a keyboard interface for a standard scroll bar, you can create one yourself by processing the WM_KEYDOWN message in your window procedure and then performing the appropriate scrolling action based on the virtual-key code that accompanies the message. For information about how to create a keyboard interface for a scroll bar, see Creating a Keyboard Interface for a Standard Scroll Bar .

Scrolling the Client Area

The simplest way to scroll the content of a client area is to erase and then redraw it. This is the method an application is likely to use with SB_PAGEUP, SB_PAGEDOWN, and SB_TOP request codes, which typically require completely new content.

For some request codes, such as SB_LINEUP and SB_LINEDOWN, not all the content need be erased, because some remains visible after scrolling occurs. The ScrollWindowEx function preserves a portion of the client area's content, move the preserved portion a specified amount, and then prepares the rest of the client area for painting new information. ScrollWindowEx uses the BitBlt function to move a specific part of the data object to a new location within the client area. Any uncovered part of the client area (anything not preserved) is invalidated, erased, and painted when the next WM_PAINT message occurs.

The ScrollWindowEx function can be used to exclude a portion of the client area from the scrolling operation. This keeps items with fixed positions, such as child windows, from moving within the client area. It automatically invalidates the portion of the client area that is to receive the new information, so the application does not have to compute its own clipping regions. For more information on clipping, see Clipping .

Usually an application scrolls the content of a window in the direction opposite that indicated by the scroll bar. For example, when the user clicks the shaft in the area below the scroll box, an application scrolls the object in the window upward to reveal a portion of the object that is below the visible portion.

You can also scroll a rectangular region using the ScrollDC function.

Scroll Bar Colors and Metrics

The system-defined color value, COLOR_SCROLLBAR, controls the color within a scroll bar's shaft. Use the GetSysColor function to determine the color of the shaft and the SetSysColors function to set the color of the shaft. Note, however, that this change of color affects all scroll bars in the system.

You can get the dimensions of the bitmaps that the system uses in standard scroll bars by calling the GetSystemMetrics function. Following are the system metric values associated with scroll bars.

System metric | Description
SM_CXHSCROLL | Width of arrow bitmap on horizontal scroll bar
SM_CXHTHUMB | Width of scroll box on horizontal scroll bar. This value retrieves the width a scroll bar that has a page size of zero.
SM_CXVSCROLL | Width of arrow bitmap on vertical scroll bar
SM_CYHSCROLL | Height of arrow bitmap on horizontal scroll bar
SM_CYVSCROLL | Height of arrow bitmap on vertical scroll bar
SM_CYVTHUMB | Height of scroll box on vertical scroll bar. This value retrieves the height of a scroll bar that has a page size of zero.


About Static Controls

Applications often use static controls to label other controls or to separate a group of controls. Although static controls are child windows, they cannot be selected. Therefore, they cannot receive the keyboard focus and cannot have a keyboard interface. A static control that has the SS_NOTIFY style receives mouse input, notifying the parent window when the user clicks or double clicks the control. Static controls belong to the STATIC window class.

Although static controls can be used in overlapped, pop-up, and child windows, they are designed for use in dialog boxes, where the system standardizes their behavior. By using static controls outside dialog boxes, a developer increases the risk that the application might behave in a nonstandard fashion. Typically, a developer either uses static controls in dialog boxes or uses the SS_OWNERDRAW style to create customized static controls.

For more information about dialog boxes, see Dialog Boxes . For more information about window classes, see Window Classes . For more information about window subclassing, see Window Procedures .

Note To use visual styles with static controls, an application must include a manifest and must call InitCommonControls at the beginning of the program. For information on visual styles, see Visual Styles . For information on manifests, see Using Windows XP Visual Styles .

The following topics are discussed in this section.

  • Static Control Types
  • Static Control Default Message Processing

Static Control Types

There are four types of static controls. Each type has one or more styles.

  • Simple Graphics Static Control
  • Text Static Control
  • Image Static Controls
  • Owner-Drawn Static Control

For a table of static control styles, see Static Control Styles .

Simple Graphics Static Control

A simple graphics static control displays a frame or a filled rectangle. A frame can be drawn in a number of styles, included black, gray, or white. In addition, a frame can be drawn with an etched style to give it a three-dimensional appearance. The frame styles include SS_BLACKFRAME, SS_GRAYFRAME, SS_WHITEFRAME, SS_ETCHEDHORZ, SS_ETCHEDVERT, and SS_ETCHEDFRAME.

A rectangle can be filled with color in one of three styles: black, gray, or white. These styles are defined by the constants SS_BLACKRECT, SS_GRAYRECT, and SS_WHITERECT.

Text Static Control

A text static control displays text in a rectangle in one of five styles:

  • left-aligned without word wrap
  • left-aligned with word wrap
  • centered
  • right-aligned
  • simple

These styles are defined by the constants SS_LEFTNOWORDWRAP, SS_LEFT, SS_CENTER, SS_RIGHT, and SS_SIMPLE, respectively. The system rearranges the text in these controls in predefined ways, except for "simple" text, which is not rearranged.

An application can change the text in a text static control at any time by using the SetWindowText function or the WM_SETTEXT message.

The system displays as much text as it can in the static control and clips whatever does not fit. To calculate an appropriate size for the control, retrieve the font metrics for the text. For more information about fonts and font metrics, see Fonts and Text .

Image Static Controls

An image static control can display bitmaps, icons (including animated icons), or enhanced metafiles. The type of graphic that a particular static control displays depends on the control's style: SS_BITMAP, SS_ICON, or SS_ENHMETAFILE. An application specifies the style when it creates the control and also specifies a handle to the bitmap, icon, or metafile for the control to display. After the control is created, an application can associate a different graphic with the control by sending it an STM_SETIMAGE message, specifying a handle to the new graphic object. An application can retrieve a handle to the graphic object currently associated with a static control by sending it an STM_GETIMAGE message. An application sends messages to a static control by using the SendDlgItemMessage function.

Owner-Drawn Static Control

By using the SS_OWNERDRAW style, an application can take responsibility for painting a static control. The parent window of an owner-drawn static control (its owner) receives a WM_DRAWITEM message whenever the static control needs to be painted. The message includes a pointer to a DRAWITEMSTRUCT structure that contains information that the owner window uses when drawing the control.

Static Control Default Message Processing

The window procedure for the predefined static control window class performs default processing for all messages that the static control procedure does not process. When the static control returns FALSE for any message, the predefined window procedure checks the messages and carries out the default action described in the following table. In the table, a text static control is a static control with the style SS_LEFTNOWORDWRAP, SS_LEFT, SS_CENTER, SS_RIGHT, or SS_SIMPLE.

Message | Default action
WM_CREATE | Loads the graphic object and sizes the window to the object's size, for graphic static controls. Takes no action for other static controls.
WM_DESTROY | Frees and destroys any graphic object, for graphic static controls. Takes no action for other static controls.
WM_ENABLE | Repaints visible static controls.
WM_ERASEBKGND | Returns TRUE, indicating the control erases the background.
WM_GETDLGCODE | Returns DLGC_STATIC.
WM_GETFONT | Returns a handle to the font for text static controls.
WM_GETTEXT | Returns the number of characters copied.
WM_GETTEXTLENGTH | Returns the length, in characters, of the text for a text static control.
WM_LBUTTONDBLCLK | Sends the parent window an STN_DBLCLK notification message if the control style is SS_NOTIFY.
WM_LBUTTONDOWN | Sends the parent window an STN_CLICKED notification message if the control style is SS_NOTIFY.
WM_NCLBUTTONDBLCLK | Sends the parent window an STN_DBLCLK notification message if the control style is SS_NOTIFY.
WM_NCLBUTTONDOWN | Sends the parent window an STN_CLICKED notification message if the control style is SS_NOTIFY.
WM_NCHITTEST | Returns HTCLIENT if the control style is SS_NOTIFY; otherwise, returns HTTRANSPARENT.
WM_PAINT | Repaints the control.
WM_SETFONT | Sets the font and repaints for text static controls.
WM_SETTEXT | Sets the text and repaints for text static controls.

The predefined window procedure passes all other messages to DefWindowProc for default processing.


Status Bars

A status bar is a horizontal window at the bottom of a parent window in which an application can display various kinds of status information. The status bar can be divided into parts to display more than one type of information.

  • Using Status Bars
  • Status Bar Updates in Internet Explorer

Using Status Bars

You can create a status bar by using the CreateStatusWindow function or by using the CreateWindowEx function and specifying the STATUSCLASSNAME window class. To ensure that the common control dynamic-link library (DLL) is loaded, use the InitCommonControls function first. After you create the status bar, you can divide it into parts, set the text for each part, and control the appearance of the window by using status bar messages.

Types and Styles

The default position of a status bar is along the bottom of the parent window, but you can specify the CCS_TOP style to have it appear at the top of the parent window's client area.

You can specify the SBARS_SIZEGRIP style to include a sizing grip at the right end of the status bar.

Note Combining the CCS_TOP and SBARS_SIZEGRIP styles is not recommended because the resulting sizing grip is not functional.

Size and Height

The window procedure for the status bar automatically sets the initial size and position of the window, ignoring the values specified in the CreateWindowEx function. The width is the same as that of the parent window's client area. The height is based on the metrics of the font that is currently selected into the status bar's device context and on the width of the window's borders.

The window procedure automatically adjusts the size of the status bar whenever it receives a WM_SIZE message. Typically, when the size of the parent window changes, the parent sends a WM_SIZE message to the status bar.

An application can set the minimum height of a status bar's drawing area by sending the window an SB_SETMINHEIGHT message, specifying the minimum height, in pixels. The drawing area does not include the window's borders. A minimum height is useful for drawing in an owner-drawn status bar. For more information, see Owner-Drawn Status Bars later in this chapter.

You retrieve the widths of the borders of a status bar by sending the window an SB_GETBORDERS message. The message includes the address of a three-element array that receives the widths.

Multiple-Part Status Bars

A status bar can have many different parts, each displaying a different line of text. You divide a status bar into parts by sending the window an SB_SETPARTS message, specifying the number of parts to create and the address of an integer array. The array contains one element for each part, and each element specifies the client coordinate of the right edge of a part.

A status bar can have a maximum of 256 parts, although applications typically use far fewer than that. You retrieve a count of the parts in a status bar, as well as the coordinate of the right edge of each part, by sending the window an SB_GETPARTS message.

Status Bar Text Operations

You set the text of any part of a status bar by sending the SB_SETTEXT message, specifying the zero-based index of a part, an address of the string to draw in the part, and the technique for drawing the string. The drawing technique determines whether the text has a border and, if it does, the style of the border. It also determines whether the parent window is responsible for drawing the text. For more information, see the Owner-Drawn Status Bars section below.

By default, text is left-aligned within the specified part of a status bar. You can embed tab characters (\ t) in the text to center or right-align it. Text to the right of a single tab character is centered, and text to the right of a second tab character is right-aligned.

To retrieve text from a status bar, use the SB_GETTEXTLENGTH and SB_GETTEXT messages.

If your application uses a status bar that has only one part, you can use the WM_SETTEXT , WM_GETTEXT , and WM_GETTEXTLENGTH messages to perform text operations. These messages deal only with the part that has an index of zero, allowing you to treat the status bar much like a static text control.

To display a line of status without creating a status bar, use the DrawStatusText function. The function uses the same techniques to draw the status as the window procedure for the status bar, but it does not automatically set the size and position of the status information. When calling the function, you must specify the size and position of the status information as well as the device context of the window in which to draw it.

Owner-Drawn Status Bars

You can define individual parts of a status bar to be owner-drawn parts. Using this technique gives you more control than you would otherwise have over the appearance of the window part. For example, you can display a bitmap rather than text or draw text using a different font.

To define a window part as owner-drawn, send the SB_SETTEXT message to the status bar, specifying the part and the SBT_OWNERDRAW drawing technique. When SBT_OWNERDRAW is specified, the lParam parameter is a 32-bit application-defined value that the application can use when drawing the part. For example, you can specify a font handle, a bitmap handle, an address of a string, and so on.

When a status bar needs to draw an owner-drawn part, it sends the WM_DRAWITEM message to the parent window. The wParam parameter of the message is the child window identifier of the status bar, and the lParam parameter is the address of a DRAWITEMSTRUCT structure. The parent window uses the information in the structure to draw the part. For an owner-drawn part of a status bar, DRAWITEMSTRUCT contains the following information.

Member | Description
CtlType | Undefined; do not use.
CtlID | Child window identifier of the status bar.
itemID | Zero-based index of the part to be drawn.
itemAction | Undefined; do not use.
itemState | Undefined; do not use.
hwndItem | Handle to the status bar.
hDC | Handle to the device context of the status bar.
rcItem | Coordinates of the window part to be drawn. The coordinates are relative to the upper left corner of the status bar.
itemData | Application-defined 32-bit value specified in the lParam parameter of the SB_SETTEXT message.

Simple Mode Status Bars

You put a status bar in "simple mode" by sending it an SB_SIMPLE message. A simple mode status bar displays only one part. When the text of the window is set, the window is invalidated, but it is not redrawn until the next WM_PAINT . Waiting for the message reduces screen flicker by minimizing the number of times the window is redrawn. A simple mode status bar is useful for displaying Help text for menu items while the user is scrolling through the menu.

The string that a status bar displays while in simple mode is maintained separately from the strings that it displays while in nonsimple mode. This means you can put the window in simple mode, set its text, and switch back to nonsimple mode without the nonsimple mode text being changed.

When setting the text of a simple mode status bar, you can specify any drawing technique except SBT_OWNERDRAW. A simple mode status bar does not support owner drawing.

Default Status Bar Message Processing

This section describes the messages handled by the window procedure for the predefined STATUSCLASSNAME class.

Message | Default processing
WM_CREATE | Initializes the status bar.
WM_DESTROY | Frees resources allocated for the status bar.
WM_GETFONT | Returns the handle to the current font with which the status bar draws its text.
WM_GETTEXT | Copies the text from the first part of a status bar to a buffer. It returns a 32-bit value that specifies the length, in characters, of the text and the technique used to draw the text.
WM_GETTEXTLENGTH | Returns a 32-bit value that specifies the length, in characters, of the text in the first part of a status bar and the technique used to draw the text.
WM_NCHITTEST | Returns the HTBOTTOMRIGHT value if the mouse cursor is in the sizing grip, causing the system to display the sizing cursor. If the mouse cursor is not in the sizing grip, the status bar passes this message to the DefWindowProc function.
WM_PAINT | Paints the invalid region of the status bar. If the wParam parameter is non-NULL, the control assumes that the value is an HDC and paints using that device context.
WM_SETFONT | Selects the font handle into the device context for the status bar.
WM_SETTEXT | Copies the specified text into the first part of a status bar, using the default drawing operation (specified as zero). It returns TRUE if successful, or FALSE otherwise.
WM_SIZE | Resizes the status bar based on the current width of the parent window's client area and the height of the current font of the status bar.

Status Bar Example

The following example demonstrates how to create a status bar that has a sizing grip and divide the window into four equal parts based on the width of the parent window's client area.

Example

// DoCreateStatusBar - creates a status bar and divides it into
// the specified number of parts.
// Returns the handle to the status bar.
// hwndParent - parent window for the status bar.
// nStatusID - child window identifier.
// hinst - handle to the application instance.
// nParts - number of parts into which to divide the status bar.
HWND DoCreateStatusBar(HWND hwndParent, int nStatusID, HINSTANCE
                      hinst, int nParts)
{
    HWND hwndStatus;
    RECT rcClient;
    HLOCAL hloc;
    LPINT lpParts;
    int i, nWidth;

    // Ensure that the common control DLL is loaded.
    InitCommonControls();

    // Create the status bar.
    hwndStatus = CreateWindowEx(
        0,                       // no extended styles
        STATUSCLASSNAME,         // name of status bar class
        (LPCTSTR) NULL,          // no text when first created
        SBARS_SIZEGRIP |         // includes a sizing grip
        WS_CHILD,                // creates a child window
        0, 0, 0, 0,              // ignores size and position
        hwndParent,              // handle to parent window
        (HMENU) nStatusID,       // child window identifier
        hinst,                   // handle to application instance
        NULL);                   // no window creation data

    // Get the coordinates of the parent window's client area.
    GetClientRect(hwndParent, &rcClient);

    // Allocate an array for holding the right edge coordinates.
    hloc = LocalAlloc(LHND, sizeof(int) * nParts);
    lpParts = LocalLock(hloc);

    // Calculate the right edge coordinate for each part, and
    // copy the coordinates to the array.
    nWidth = rcClient.right / nParts;
    for (i = 0; i < nParts; i++) {
       lpParts[i] = nWidth;
       nWidth += nWidth;
    }

    // Tell the status bar to create the window parts.
    SendMessage(hwndStatus, SB_SETPARTS, (WPARAM) nParts, (LPARAM)
               lpParts);

    // Free the array, and return.
    LocalUnlock(hloc);
    LocalFree(hloc);
    return hwndStatus;
}

Status Bar Updates in Internet Explorer

Status bar controls in Microsoft® Internet Explorer support the following new features.

Icon Support | Icons can now be displayed in a status bar. The SB_SETICON message is used to set the icon.
ToolTip Support | The status bar now supports ToolTips. To enable ToolTips, the SBT_TOOLTIPS style must be set when the status bar is created. The SB_SETTIPTEXT and SB_GETTIPTEXT messages are used to set and retrieve the ToolTip text, respectively. The ToolTip for a part will only be displayed if the part has an icon and no text or if all of the text cannot be displayed inside the part. ToolTips are not supported in simple mode.
Enhanced Simple Mode Support | The SB_ISSIMPLE message has been added to determine if a status bar is in simple mode. The SBN_SIMPLEMODECHANGE notification has been added to inform the owner that the simple mode has changed.
Background Color Support | The SB_SETBKCOLOR message has been added to allow the background color of a status bar to be modified.


Tab Controls

A tab control is analogous to the dividers in a notebook or the labels in a file cabinet. By using a tab control, an application can define multiple pages for the same area of a window or dialog box. Each page consists of a certain type of information or a group of controls that the application displays when the user selects the corresponding tab.

  • About Tab Controls
  • Using Tab Controls
  • Tab Control Updates in Internet Explorer

About Tab Controls

You can create a tab control by calling the CreateWindowEx function, specifying the WC_TABCONTROL window class. This window class is registered when the common controls dynamic-link library (DLL) is loaded. To ensure that the DLL is loaded, use the InitCommonControls function.

You send messages to a tab control to add tabs and otherwise affect the control's appearance and behavior. Each message has a corresponding macro that you can use instead of sending the message explicitly. You cannot disable an individual tab in a tab control. However, you can disable a tab control in a property sheet by disabling the corresponding page.

About Tab Control Styles

You can apply certain characteristics to tab controls by specifying tab control styles when the control is created. For example, you can specify the alignment and general appearance of the tabs in a tab control.

You can cause the tabs to look like buttons by specifying the TCS_BUTTONS style. Tabs in this type of tab control should serve the same function as button controls; that is, clicking a tab should carry out a command instead of displaying a page. Because the display area in a button tab control is typically not used, no border is drawn around it.

You can cause a tab to receive the input focus when clicked by specifying the TCS_FOCUSONBUTTONDOWN style. This style is typically used only with the TCS_BUTTONS style. You can specify that a tab does not receive input focus when clicked by using the TCS_FOCUSNEVER style.

By default, a tab control displays only one row of tabs. If not all tabs can be shown at once, the tab control displays an up-down control so that the user can scroll additional tabs into view. You can cause a tab control to display multiple rows of tabs, if necessary, by specifying the TCS_MULTILINE style. With this style, all tabs can be displayed at once. The tabs are left-aligned within each row unless you specify the TCS_RIGHTJUSTIFY style. In this case, the width of each tab is increased so that each row of tabs fills the entire width of the tab control.

A tab control automatically sizes each tab to fit its icon, if any, and its label. To give all tabs the same width, you can specify the TCS_FIXEDWIDTH style. The control sizes all the tabs to fit the widest label, or you can assign a specific width and height by using the TCM_SETITEMSIZE message. Within each tab, the control centers the icon and label, placing the icon to the left of the label. You can force the icon to the left, leaving the label centered, by specifying the TCS_FORCEICONLEFT style. You can left-align both the icon and label by using the TCS_FORCELABELLEFT style. You cannot use the TCS_FIXEDWIDTH style with the TCS_RIGHTJUSTIFY style.

You can specify that the parent window draws the tabs in the control by using the TCS_OWNERDRAWFIXED style. For more information, see Owner-Drawn Tabs.

You can specify that a tab control will create a ToolTip control by using the TCS_TOOLTIPS style. For more information about this, see Tab Control ToolTips.

Tabs and Tab Attributes

Each tab in a tab control consists of an icon, a label, and application-defined data. This information is specified by a TCITEM structure. You can add tabs to a tab control, retrieve the number of tabs, retrieve and set the contents of a tab, and delete tabs. Tabs are identified by their zero-based index.

To add tabs to a tab control, use the TCM_INSERTITEM message, specifying the position of the item and the address of a TCITEM structure. You can retrieve and set the contents of an existing tab by using the TCM_GETITEM and TCM_SETITEM messages. For each tab, you can specify an icon, a label, or both. You can also specify application-defined data to associate with the tab.

You can retrieve the current number of tabs by using the TCM_GETITEMCOUNT message, delete a tab by using the TCM_DELETEITEM message, and delete all tabs in a tab control by using the TCM_DELETEALLITEMS message.

You can associate application-defined data with each tab. For example, you might save information about each page with its corresponding tab. By default, a tab control allocates four extra bytes per tab for application-defined data. You can change the number of extra bytes per tab by using the TCM_SETITEMEXTRA message. You can only use this message when the tab control is empty.

The application-defined data is specified by the lParam member of the TCITEM structure. If you use more than 4 bytes of application-defined data, you need to define your own structure and use it instead of TCITEM. You can retrieve and set application-defined data the same way you retrieve and set other information about a tab—by using the TCM_GETITEM and TCM_SETITEM messages.

The first member of your structure must be a TCITEMHEADER structure, and the remaining members must specify application-defined data. TCITEMHEADER is identical to TCITEM, except it does not have the lParam member. The difference between the size of your structure and the size of TCITEMHEADER should equal the number of extra bytes per tab.

Display Area

The display area of a tab control is the area in which an application displays the current page. Typically, an application creates a child window or dialog box, setting the window size and position to fit the display area. Given the window rectangle for a tab control, you can calculate the bounding rectangle of the display area by using the TCM_ADJUSTRECT message.

Sometimes the display area must be a particular size—for example, the size of a modeless child dialog box. Given the bounding rectangle for the display area, you can use TCM_ADJUSTRECT to calculate the corresponding window rectangle for the tab control.

Tab Selection

When the user selects a tab, a tab control sends its parent window notification messages in the form of WM_NOTIFY messages. The TCN_SELCHANGING notification message is sent before the selection changes, and the TCN_SELCHANGE notification message is sent after the selection changes.

You can process TCN_SELCHANGING to save the state of the outgoing page. You can return TRUE to prevent the selection from changing. For example, you might not want to switch away from a child dialog box in which a control has an invalid setting.

You must process TCN_SELCHANGE to display the incoming page in the display area. This might simply entail changing the information displayed in a child window. More often, each page consists of a child window or dialog box. In this case, an application might process this notification by destroying or hiding the outgoing child window or dialog box and by creating or showing the incoming child window or dialog box.

You can retrieve and set the current selection by using the TCM_GETCURSEL and TCM_SETCURSEL messages.

Tab Control Image Lists

Each tab can have an icon associated with it, which is specified by an index in the image list for the tab control. When a tab control is created, it has no image list associated with it. An application can create an image list by using the ImageList_Create function and then assign it to a tab control by using the TCM_SETIMAGELIST message.

You can add images to a tab control's image list just as you would to any other image list. However, an application should remove images by using the TCM_REMOVEIMAGE message instead of the ImageList_Remove function. This message ensures that each tab remains associated with the same image as before.

Destroying a tab control does not destroy an image list that is associated with it. You must destroy the image list separately. This is useful if you want to assign the same image list to multiple tab controls.

To retrieve the handle to the image list currently associated with a tab control, you can use the TCM_GETIMAGELIST message.

Tab Size and Position

Each tab in a tab control has a size and position. You can set the size of tabs, retrieve the bounding rectangle of a tab, or determine which tab is at a specified position.

For fixed-width and owner-drawn tab controls, you can set the exact width and height of tabs by using the TCM_SETITEMSIZE message. In other tab controls, each tab's size is calculated based on the icon and label for the tab. The tab control includes space for a border and an additional margin. You can set the thickness of the margin by using the TCM_SETPADDING message.

You can determine the current bounding rectangle for a tab by using the TCM_GETITEMRECT message. You can determine which tab, if any, is at a specified location by using the TCM_HITTEST message.

In a tab control with the TCS_MULTILINE style, you can determine the current number of rows of tabs by using the TCM_GETROWCOUNT message.

Owner-Drawn Tabs

If a tab control has the TCS_OWNERDRAWFIXED style, the parent window must paint tabs by processing the WM_DRAWITEM message. The tab control sends this message whenever a tab needs to be painted. The lParam parameter specifies the address of a DRAWITEMSTRUCT structure, which contains the index of the tab, its bounding rectangle, and the device context (DC) in which to draw.

By default, the itemData member of DRAWITEMSTRUCT contains the value of the lParam member of the TCITEM structure. However, if you change the amount of application-defined data per tab, itemData contains the address of the data instead. You can change the amount of application-defined data per tab by using the TCM_SETITEMEXTRA message.

To specify the size of items in a tab control, the parent window must process the WM_MEASUREITEM message. Because all tabs in an owner-drawn tab control are the same size, this message is sent only once. There is no tab control style for owner-drawn tabs of varying size. You can also set the width and height of tabs by using the TCM_SETITEMSIZE message.

Tab Control ToolTips

You can use a ToolTip control to provide a brief description of each tab in a tab control. A tab control that has the TCS_TOOLTIPS style creates a ToolTip control when it is created and destroys the ToolTip control when it is destroyed. You can also create a ToolTip control and assign it to a tab control.

If you use a ToolTip control with a tab control, the parent window must process the TTN_GETDISPINFO notification message to provide a description of each tab on request.

To use the same ToolTip control with more than one tab control, create the ToolTip control yourself and assign it to the tab control by using the TCM_SETTOOLTIPS message. You can retrieve the handle to a tab control's current ToolTip control by using the TCM_GETTOOLTIPS message. If you create your own ToolTip control, you should not use the TCS_TOOLTIPS style. For more information about ToolTip controls, see ToolTip Controls .

Default Tab Control Message Processing

This section describes the message processing performed by a tab control. Messages specific to tab controls are discussed in other sections of this documentation.

Message | Processing performed
WM_CAPTURECHANGED | Does nothing if the tab control released the mouse capture itself. If another window captured the mouse and a button is held down, the command releases the button.
WM_CREATE | Allocates and initializes an internal data structure. The control creates a ToolTip control if the TCS_TOOLTIPS style is specified.
WM_DESTROY | Frees resources allocated during WM_CREATE processing.
WM_GETDLGCODE | Returns a combination of the DLGC_WANTARROWS and DLGC_WANTCHARS values.
WM_GETFONT | Returns the handle to the font used for labels.
WM_KEYDOWN | Processes direction keys and changes the selection, if appropriate.
WM_KILLFOCUS | Invalidates the tab that has the focus so it will be repainted to reflect an unfocused state.
WM_LBUTTONDOWN | Forwards the message to the ToolTip control, if any, and changes the selection if the user is clicking a tab. If the user is clicking a button, the control redraws the button to give a sunken appearance and captures the mouse. If the user is clicking either a tab or button and the TCS_FOCUSONBUTTONDOWN style is specified, the control sets the focus to itself.
WM_LBUTTONUP | Releases the mouse if a button was pressed. If the cursor is over the button and is being held down, the control changes the selection accordingly and redraws the button.
WM_MOUSEMOVE | Forwards the message to the ToolTip control, if any. If the TCS_BUTTONS style is specified and the mouse button is being held down after clicking, the control may also redraw the affected button to give it a raised or sunken appearance.
WM_NOTIFY | Forwards notification messages sent by the ToolTip control.
WM_PAINT | Draws a border around the display area (unless the TCS_BUTTONS style is specified) and paints any tabs that intersect the invalid rectangle. For each tab, it draws the body of the tab (or sends a WM_DRAWITEM message to the parent window) and then draws a border around the tab. If the wParam parameter is non-NULL, the control assumes that the value is an HDC and paints using that device context.
WM_RBUTTONDOWN | Sends an NM_RCLICK notification message to the parent window.
WM_SETFOCUS | Invalidates the tab that has the focus so that it will be repainted to reflect a focused state.
WM_SETFONT | Sets the font used for labels.
WM_SETREDRAW | Sets the state of an internal flag that determines whether the control is repainted when items are inserted and deleted, when the font is changed, and so on.
WM_SIZE | Recalculates the positions of tabs and may invalidate part of the tab control to force repainting of some or all tabs.

Using Tab Controls

This section provides two examples that use tab controls. The first example demonstrates how to use a tab control to switch between multiple pages of text in an application's main window. The second example demonstrates how to use a tab control to switch between multiple pages of controls in a dialog box.

Creating a Tab Control

The example in this section demonstrates how to create a tab control and display it in the client area of the application's main window. The application displays a third window (a static control) in the display area of the tab control. The parent window positions and sizes the tab control and static control when it processes the WM_SIZE message.

There are seven tabs, one for each day of the week. When the user selects a tab, the application displays the name of the corresponding day in the static control. The following global variables are used in this example.

// Global variables

HINSTANCE g_hinst;    // handle to application instance
char g_achTemp[256];  // temporary buffer for strings
HWND g_hwndMain;      // main application window
HWND g_hwndTab;       // tab control
HWND g_hwndDisplay;   // handle to static control in
                      //   tab control's display area

The following function creates the tab control and adds a tab for each day of the week. The names of the days are defined as string resources, consecutively numbered starting with IDS_FIRSTDAY (defined in the application's header file). Both the parent window and the tab control must have the WS_CLIPSIBLINGS window style. The application's initialization function calls this function after creating the main window.

// DoCreateTabControl - creates a tab control, sized to fit the
//     specified parent window's client area, and adds some tabs.
// Returns the handle to the tab control.
// hwndParent - parent window (the application's main window).

HWND WINAPI DoCreateTabControl(HWND hwndParent)
{
    RECT rcClient;
    HWND hwndTab;
    TCITEM tie;
    int i;

    // Get the dimensions of the parent window's client area, and
    // create a tab control child window of that size.
    GetClientRect(hwndParent, &rcClient);
    InitCommonControls();
    hwndTab = CreateWindow(
        WC_TABCONTROL, "",
        WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE,
        0, 0, rcClient.right, rcClient.bottom,
        hwndParent, NULL, g_hinst, NULL
        );
    if (hwndTab == NULL)
        return NULL;

    // Add tabs for each day of the week.
    tie.mask = TCIF_TEXT | TCIF_IMAGE;
    tie.iImage = -1;
    tie.pszText = g_achTemp;

    for (i = 0; i < 7; i++) {
        LoadString(g_hinst, IDS_FIRSTDAY + i,
                g_achTemp, sizeof(g_achTemp)/sizeof(g_achTemp[0]));
        if (TabCtrl_InsertItem(hwndTab, i, &tie) == -1) {
            DestroyWindow(hwndTab);
            return NULL;
        }
    }
    return hwndTab;
}

The following function creates the static control that occupies the tab control's display area. The application's initialization function calls this function after creating the main window and the tab control.

// DoCreateDisplayWindow - creates a child window (a static
//     control) to occupy the tab control's display area.
// Returns the handle to the static control.
// hwndParent - parent window (the application's main window).

HWND WINAPI DoCreateDisplayWindow(HWND hwndParent)
{
    HWND hwndStatic = CreateWindow("STATIC", "",
        WS_CHILD | WS_VISIBLE | WS_BORDER,
        0, 0, CW_USEDEFAULT, CW_USEDEFAULT,
        hwndParent, NULL, g_hinst, NULL);

    return hwndStatic;
}

Following are the relevant portions of the application's window procedure. The application processes the WM_SIZE message to position and size the tab control and the static control. To determine the appropriate position and size for the static control, this example sends the tab control a TCM_ADJUSTRECT message (by using the TabCtrl_AdjustRect macro).

When a tab is selected, the tab control sends a WM_NOTIFY message, specifying the TCN_SELCHANGE notification message. The application processes this notification message by setting the text of the static control.

// MainWindowProc - processes the message for the main window class.
// The return value depends on the message.
// hwnd - handle to the window.
// uMsg - identifier for the message.
// wParam - message-specific parameter.
// lParam - message-specific parameter.

LRESULT CALLBACK MainWindowProc(
        HWND hwnd,
        UINT uMsg,
        WPARAM wParam,
        LPARAM lParam
        )
{
    switch (uMsg) {
        case WM_SIZE: {
                HDWP hdwp;
                RECT rc;

                // Calculate the display rectangle, assuming the
                // tab control is the size of the client area.
                SetRect(&rc, 0, 0,
                        GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
                TabCtrl_AdjustRect(g_hwndTab, FALSE, &rc);

                // Size the tab control to fit the client area.
                hdwp = BeginDeferWindowPos(2);
                DeferWindowPos(hdwp, g_hwndTab, NULL, 0, 0,
                    GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam),
                    SWP_NOMOVE | SWP_NOZORDER
                    );

                // Position and size the static control to fit the
                // tab control's display area, and make sure the
                // static control is in front of the tab control.
                DeferWindowPos(hdwp,
                    g_hwndDisplay, HWND_TOP, rc.left, rc.top,
                    rc.right - rc.left, rc.bottom - rc.top, 0
                    );
                EndDeferWindowPos(hdwp);
            }
            break;

        case WM_NOTIFY:
            switch (HIWORD(wParam)) {
                case 0:
                    .
                    .    // menu command processing
                    .

                case TCN_SELCHANGE: {
                        int iPage = TabCtrl_GetCurSel(g_hwndTab);
                        LoadString(g_hinst, IDS_FIRSTDAY + iPage,
                            g_achTemp,
                            sizeof(g_achTemp)/sizeof(g_achTemp[0]));
                        SendMessage(g_hwndDisplay, WM_SETTEXT, 0,
                            (LPARAM) g_achTemp);
                    }
                    break;
            }
            break;

            .
            .       // additional message processing
            .

        default:
            return DefWindowProc(hwnd, uMsg, wParam, lParam);
    }
    return 0;
}

Creating a Tabbed Dialog Box

The example in this section demonstrates how to create a dialog box that uses tabs to provide multiple pages of controls. The main dialog box is a modal dialog box. Each page of controls is defined by a dialog box template that has the WS_CHILD style. When a tab is selected, a modeless dialog box is created for the incoming page and the dialog box for the outgoing page is destroyed.

Note In many cases, you can implement multiple-page dialog boxes more easily by using property sheets. For more information about property sheets, see Property Sheets

The template for the main dialog box simply defines two button controls. When processing the WM_INITDIALOG message, the dialog box procedure creates a tab control and loads the dialog box template resources for each of the child dialog boxes.

The information is saved in an application-defined structure called DLGHDR. A pointer to this structure is associated with the dialog box window by using the SetWindowLong function. The structure is defined in the application's header file, as follows:

#define C_PAGES 3

typedef struct tag_dlghdr {
    HWND hwndTab;       // tab control
    HWND hwndDisplay;   // current child dialog box
    RECT rcDisplay;     // display rectangle for the tab control
    DLGTEMPLATE *apRes[C_PAGES];
} DLGHDR;

The following function processes the WM_INITDIALOG message for the main dialog box. The function allocates the DLGHDR structure, loads the dialog box template resources for the child dialog boxes, and creates the tab control.

The size of each child dialog box is specified by the DLGTEMPLATE structure. The function examines the size of each dialog box and uses the macro for the TCM_ADJUSTRECT message to calculate an appropriate size for the tab control. Then it sizes the dialog box and positions the two buttons accordingly. This example sends TCM_ADJUSTRECT by using the TabCtrl_AdjustRect macro.

VOID WINAPI OnTabbedDialogInit(HWND hwndDlg)
{
    DLGHDR *pHdr = (DLGHDR *) LocalAlloc(LPTR, sizeof(DLGHDR));
    DWORD dwDlgBase = GetDialogBaseUnits();
    int cxMargin = LOWORD(dwDlgBase) / 4;
    int cyMargin = HIWORD(dwDlgBase) / 8;
    TCITEM tie;
    RECT rcTab;
    HWND hwndButton;
    RECT rcButton;
    int i;

    // Save a pointer to the DLGHDR structure.
    SetWindowLong(hwndDlg, GWL_USERDATA, (LONG) pHdr);

    // Create the tab control.
    InitCommonControls();
    pHdr->hwndTab = CreateWindow(
        WC_TABCONTROL, "",
        WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE,
        0, 0, 100, 100,
        hwndDlg, NULL, g_hinst, NULL
        );
    if (pHdr->hwndTab == NULL) {
        // handle error
    }

    // Add a tab for each of the three child dialog boxes.
    tie.mask = TCIF_TEXT | TCIF_IMAGE;
    tie.iImage = -1;
    tie.pszText = "First";
    TabCtrl_InsertItem(pHdr->hwndTab, 0, &tie);
    tie.pszText = "Second";
    TabCtrl_InsertItem(pHdr->hwndTab, 1, &tie);
    tie.pszText = "Third";
    TabCtrl_InsertItem(pHdr->hwndTab, 2, &tie);

    // Lock the resources for the three child dialog boxes.
    pHdr->apRes[0] = DoLockDlgRes(MAKEINTRESOURCE(DLG_FIRST));
    pHdr->apRes[1] = DoLockDlgRes(MAKEINTRESOURCE(DLG_SECOND));
    pHdr->apRes[2] = DoLockDlgRes(MAKEINTRESOURCE(DLG_THIRD));

    // Determine the bounding rectangle for all child dialog boxes.
    SetRectEmpty(&rcTab);
    for (i = 0; i < C_PAGES; i++) {
        if (pHdr->apRes[i]->cx > rcTab.right)
            rcTab.right = pHdr->apRes[i]->cx;
        if (pHdr->apRes[i]->cy > rcTab.bottom)
            rcTab.bottom = pHdr->apRes[i]->cy;
    }
    rcTab.right = rcTab.right * LOWORD(dwDlgBase) / 4;
    rcTab.bottom = rcTab.bottom * HIWORD(dwDlgBase) / 8;

    // Calculate how large to make the tab control, so
    // the display area can accommodate all the child dialog boxes.
    TabCtrl_AdjustRect(pHdr->hwndTab, TRUE, &rcTab);
    OffsetRect(&rcTab, cxMargin - rcTab.left,
            cyMargin - rcTab.top);

    // Calculate the display rectangle.
    CopyRect(&pHdr->rcDisplay, &rcTab);
    TabCtrl_AdjustRect(pHdr->hwndTab, FALSE, &pHdr->rcDisplay);

    // Set the size and position of the tab control, buttons,
    // and dialog box.
    SetWindowPos(pHdr->hwndTab, NULL, rcTab.left, rcTab.top,
            rcTab.right - rcTab.left, rcTab.bottom - rcTab.top,
            SWP_NOZORDER);

    // Move the first button below the tab control.
    hwndButton = GetDlgItem(hwndDlg, BTN_CLOSE);
    SetWindowPos(hwndButton, NULL,
            rcTab.left, rcTab.bottom + cyMargin, 0, 0,
            SWP_NOSIZE | SWP_NOZORDER);

    // Determine the size of the button.
    GetWindowRect(hwndButton, &rcButton);
    rcButton.right -= rcButton.left;
    rcButton.bottom -= rcButton.top;

    // Move the second button to the right of the first.
    hwndButton = GetDlgItem(hwndDlg, BTN_TEST);
    SetWindowPos(hwndButton, NULL,
        rcTab.left + rcButton.right + cxMargin,
        rcTab.bottom + cyMargin, 0, 0,
        SWP_NOSIZE | SWP_NOZORDER);

    // Size the dialog box.
    SetWindowPos(hwndDlg, NULL, 0, 0,
        rcTab.right + cyMargin +
        2 * GetSystemMetrics(SM_CXDLGFRAME),
        rcTab.bottom + rcButton.bottom + 2 * cyMargin +
        2 * GetSystemMetrics(SM_CYDLGFRAME) +
        GetSystemMetrics(SM_CYCAPTION),
        SWP_NOMOVE | SWP_NOZORDER);

    // Simulate selection of the first item.
    OnSelChanged(hwndDlg);
}

// DoLockDlgRes - loads and locks a dialog box template resource.
// Returns the address of the locked resource.
// lpszResName - name of the resource

DLGTEMPLATE * WINAPI DoLockDlgRes(LPCSTR lpszResName)
{
    HRSRC hrsrc = FindResource(NULL, lpszResName, RT_DIALOG);
    HGLOBAL hglb = LoadResource(g_hinst, hrsrc);
    return (DLGTEMPLATE *) LockResource(hglb);
}

The following function processes the TCN_SELCHANGE notification message for the main dialog box. The function destroys the dialog box for the outgoing page, if any. Then it uses the CreateDialogIndirect function to create a modeless dialog box for the incoming page.

// OnSelChanged - processes the TCN_SELCHANGE notification.
// hwndDlg - handle to the parent dialog box.

VOID WINAPI OnSelChanged(HWND hwndDlg)
{
    DLGHDR *pHdr = (DLGHDR *) GetWindowLong(
        hwndDlg, GWL_USERDATA);
    int iSel = TabCtrl_GetCurSel(pHdr->hwndTab);

    // Destroy the current child dialog box, if any.
    if (pHdr->hwndDisplay != NULL)
        DestroyWindow(pHdr->hwndDisplay);

    // Create the new child dialog box.
    pHdr->hwndDisplay = CreateDialogIndirect(g_hinst,
        pHdr->apRes[iSel], hwndDlg, ChildDialogProc);
}

The following function processes the WM_INITDIALOG message for each of the child dialog boxes. You cannot specify the position of a dialog box created using the CreateDialogIndirect function. This function uses the SetWindowPos function to position the child dialog within the tab control's display area.

// OnChildDialogInit - Positions the child dialog box to fall
//     within the display area of the tab control.

VOID WINAPI OnChildDialogInit(HWND hwndDlg)
{
    HWND hwndParent = GetParent(hwndDlg);
    DLGHDR *pHdr = (DLGHDR *) GetWindowLong(
        hwndParent, GWL_USERDATA);
    SetWindowPos(hwndDlg, HWND_TOP,
        pHdr->rcDisplay.left, pHdr->rcDisplay.top,
        0, 0, SWP_NOSIZE);
}

Tab Control Updates in Internet Explorer

Tab controls in Microsoft® Internet Explorer support the following new features.

Item States | Tab control items now support an item state to support the TCM_DESELECTALL message. Additionally, the TCITEM structure supports item state values. See Tab Control Item States for more information.
Extended Styles | Tab controls now support extended styles that allow the controls to have enhanced capabilities. See Tab Control Extended Styles for more information.
Structures Renamed | All structures used with tab controls have been renamed to conform to current naming conventions, while maintaining backward compatibility. For example, the TCITEM structure is now named TCITEM.


Toolbar Controls

Toolbars provide a means for users to activate commands and tools contained in an application. To make your application user-friendly, design your toolbar to expose the key functionality of the application. The following topics discuss features to consider when planning a toolbar.

  • Creating a Toolbar
  • Specifying Toolbar Size and Position
  • Displaying ToolTips for Buttons
  • Defining Button Images
  • Defining Text for Buttons
  • Adding Toolbar Buttons
  • Customizing a Toolbar
  • Using Hot-tracking
  • Using Toolbar Frames

Creating a Toolbar

You can use two functions to create a toolbar— CreateToolbarEx or CreateWindowEx . The CreateToolbarEx function creates a toolbar and adds an initial set of buttons to it. You can also use CreateWindowEx, specifying the TOOLBARCLASSNAME window class to create a toolbar that initially contains no buttons. The TOOLBARCLASSNAME window class is registered when the common control dynamic-link library (DLL) is loaded. To ensure that this DLL is loaded, use the InitCommonControlsEx function first. If you create an empty toolbar, you add buttons to it by using the TB_ADDBUTTONS or TB_INSERTBUTTON message. If you retrieve the size of the toolbar, you must send the TB_AUTOSIZE message after all the items and strings have been inserted into the control to cause the toolbar to recalculate its size based on its content.

Specifying Toolbar Size and Position

If you create a toolbar using CreateToolbarEx, the function enables you to specify in pixels the height and width of the toolbar. However, the CreateWindowEx function does not have parameters for specifying toolbar size. The toolbar window procedure automatically sets the size and position of the toolbar window. The height is based on the height of the buttons in the toolbar. The width is the same as the width of the parent window's client area. To change the automatic size settings, send a TB_SETBUTTONSIZE message. The CCS_TOP and CCS_BOTTOM common control styles determine whether the toolbar is positioned along the top or bottom of the client area. By default, a toolbar has the CCS_TOP style.

Also, the toolbar window procedure automatically adjusts the size of the toolbar whenever it receives a WM_SIZE or TB_AUTOSIZE message. An application should send either of these messages whenever the size of the parent window changes or after sending a message that requires adjusting the size of the toolbar—for example, a TB_SETBUTTONSIZE message.

The toolbar default sizing and positioning behaviors can be turned off by setting the CCS_NORESIZE and CCS_NOPARENTALIGN common control styles. Toolbar controls that are hosted by rebar controls must set these styles because the rebar control sizes and positions the toolbar.

Displaying ToolTips for Buttons

When you specify the TBSTYLE_TOOLTIPS style, the toolbar creates and manages a ToolTip control. A ToolTip control is a small pop-up window that contains a line of text describing a toolbar button. The ToolTip control is hidden and appears only when the user moves the pointer over a toolbar button and leaves it there for approximately one second. The ToolTip control is displayed near the pointer.

When the toolbar receives a WM_MOUSEMOVE message, it sends a notification message to the ToolTip control. The ToolTip control sets a timer and, after approximately one second, checks to see if the pointer is still at the same location and is on a toolbar button. If it is, the ToolTip control sends a TTN_GETDISPINFO notification message to the parent window to retrieve the descriptive text for the button. Then the ToolTip control creates a pop-up window and displays the text in the window. The ToolTip control destroys the pop-up window when the user clicks a mouse button or moves the pointer out of the toolbar.

An application that needs to send messages directly to the ToolTip control can retrieve the handle to the control by using the TB_GETTOOLTIPS message. An application can replace the ToolTip control of a toolbar with another ToolTip control by using the TB_SETTOOLTIPS message.

Defining Button Images

There are two ways to specify the images for buttons—by bitmaps or by image lists. An application must choose which method to use. It cannot use both methods with the same toolbar control. Note that the CreateToolbarEx function uses the bitmap method. Applications that want to use the image list method must use the CreateWindowEx function to create the toolbar control.

Defining Button Images by Using Bitmaps

Each button in a toolbar can include a bitmapped image. A toolbar uses an internal list to store the information that it needs to draw the images. When you call the CreateToolbarEx function, you specify a monochrome or color bitmap that contains the initial images, and the toolbar adds the information to the internal list of images. You can add additional images later by using the TB_ADDBITMAP message.

Each image has a zero-based index. The first image added to the internal list has an index of 0, the second image has an index of 1, and so on. TB_ADDBITMAP adds images to the end of the list and returns the index of the first new image that it added. To associate the image with a button, you must send a TB_ADDBUTTONS message and specify the image's index after you add bitmaps to the internal image list.

Microsoft® Windows® assumes that all of a toolbar's bitmapped images are the same size. You specify the size when you create the toolbar by using CreateToolbarEx. If you use the CreateWindowEx function to create a toolbar, the size of the images is set to the default dimensions of 16 by 15 pixels. You can use the TB_SETBITMAPSIZE message to change the dimensions of the bitmapped images, but you must do so before adding any images to the internal list.

Defining Button Images by Using Image Lists

You can also store button images in a set of Image Lists . An image list is a collection of images of the same size, each of which can be referred to by its index. Image lists are used to manage large sets of icons or bitmaps. You can use up to three different image lists to display buttons in various states, as shown in the following table.

Normal | Buttons in their default state.
Hot | Buttons that are under the pointer or pressed. Hot items are supported only in toolbar controls that have the TBSTYLE_FLAT style.
Disabled | Buttons that are disabled.

After the toolbar is destroyed, applications must free any image lists they have created.

Defining Text for Buttons

Each button can display a string in addition to, or instead of, an image. A toolbar maintains an internal list that contains all the strings available to toolbar buttons. You add strings to the internal list by using the TB_ADDSTRING message, specifying the address of the buffer containing the strings to add. Each string must be null-terminated, and the last string must be terminated with two null characters.

Each string has a zero-based index. The first string added to the internal list of strings has an index of 0, the second string has an index of 1, and so on. TB_ADDSTRING adds strings to the end of the list and returns the index of the first new string. You use a string's index to associate the string with a button.

Using TB_ADDSTRING is not the only way to add strings to a toolbar. You can display a string in a button by passing a string pointer in the iString field of the TBBUTTON structure that is passed to TB_ADDBUTTONS. Additionally, you can use TB_SETBUTTONINFO to assign text to a toolbar button. For more information, see Assigning text to a toolbar button .

Adding Toolbar Buttons

If you use the CreateToolbarEx function to create a toolbar, you can add buttons to the toolbar by filling an array of TBBUTTON structures and specifying the address of the array in the function call. However, the CreateWindowEx function does not have a parameter for passing a TBBUTTON structure. CreateWindowEx creates an empty toolbar that you fill by sending a TB_ADDBUTTONS message, specifying the address of a TBBUTTON structure.

After a toolbar is created, you can insert buttons by sending a TB_INSERTBUTTON message, which passes the address of a TBBUTTON structure to the toolbar. Each TBBUTTON structure defines the attributes of a button, including the indexes of its string and bitmap as well as its style, state, command identifier, and application-defined 32-bit value.

Note If you use the CreateWindowEx function to create a toolbar, you must send the TB_BUTTONSTRUCTSIZE message before adding any buttons. The message passes the size of the TBBUTTON structure to the toolbar.

Toolbar Button Styles

A button's style determines how the button appears and how it responds to user input. For instance, the BTNS_BUTTON style creates a toolbar button that behaves like a standard push button. A button that has the BTNS_CHECK style is similar to a standard push button, except it toggles between the pressed and nonpressed states each time the user clicks it.

You can create groups of toolbar buttons that act like radio buttons by using the BTNS_GROUP or BTNS_CHECKGROUP style. This causes a button to stay pressed until the user chooses another button in the group. A group is defined as a contiguous collection of buttons, all with the BTNS_GROUP or BTNS_CHECKGROUP style.

The BTNS_SEP style creates a small gap between buttons or draws an etch between buttons on flat toolbars. A button with the BTNS_SEP style does not receive user input.

Version 5.80 of the common controls introduced some new toolbar button styles and renamed some of the older styles. All button style flags now begin with BTNS_XXX instead of TBSTYLE_XXX. For a listing and discussion of the button styles, see Toolbar Control and Button Styles .

Toolbar Button States

Each button in a toolbar has a state. The toolbar updates a button's state to reflect user actions, such as clicking the button. The state indicates whether the button is currently pressed or not pressed, enabled or disabled, hidden or visible. Although an application sets a button's initial state when adding the button to the toolbar, it can change and retrieve the state by sending TB_GETSTATE and TB_SETSTATE messages to the toolbar. For a list of toolbar button states, see Toolbar States .

Command Identifier

Each button has an application-defined command identifier associated with it. Button identifiers are usually defined in an application header file. For example, a Paste button can be defined as:

#define ID_PASTE 100

When the user selects a button, the toolbar sends the parent window a WM_COMMAND or WM_NOTIFY message that includes the command identifier of the button. The parent window examines the command identifier and carries out the command associated with the button. For information about when controls send WM_COMMAND messages and when they send WM_NOTIFY, see the Remarks section of the WM_NOTIFY documentation.

Button Size and Position

A toolbar keeps track of its buttons by assigning each button a position index. The index is zero-based; that is, the leftmost button has an index of 0, the next button to the right has an index of 1, and so on. An application must specify the index of a button when sending messages to retrieve information about the button or to set the button's attributes.

A toolbar updates the position indexes as buttons are inserted and removed. An application can retrieve the current position index of a button by using the TB_COMMANDTOINDEX message. The message specifies the command identifier of a button, and the toolbar window uses the identifier to locate the button and return its position index.

All buttons in a toolbar are the same size. The CreateToolbarEx function requires you to set the initial size of the buttons when you create the toolbar. When you use the CreateWindowEx function, the initial size is set to the default dimensions of 24 by 22 pixels. You can use the TB_SETBUTTONSIZE message to change the button size, but you must do so before adding any buttons to the toolbar. The TB_GETITEMRECT message retrieves the current dimensions of the buttons.

When you add a string that is longer than any string currently in the toolbar, the toolbar automatically resets the width of its buttons. The width is set to accommodate the longest string in the toolbar.

Customizing a Toolbar

A toolbar has built-in customization features that you can make available to the user by giving the toolbar the CCS_ADJUSTABLE common control style. The customization features allow the user to drag a button to a new position or to remove a button by dragging it off the toolbar. In addition, the user can double-click the toolbar to display the Customize Toolbar dialog box, which allows the user to add, delete, and rearrange toolbar buttons. To display the dialog box, use the TB_CUSTOMIZE message. An application determines whether the customization features are available to the user and controls the extent to which the user can customize the toolbar.

As part of the customization process, applications often need to save and restore a toolbar's state. For instance, many applications store the toolbar state before the user begins customizing the toolbar in case the user later wants to restore the toolbar to its original state. The toolbar control does not automatically keep a record of its precustomization state. Your application must save the toolbar state in order to restore it. For more information, see Customizing Toolbars and Using Hot-tracking with Toolbars .

Using Hot-tracking

Toolbar controls created with the TBSTYLE_FLAT style support hot-tracking by default. Hot-tracking means that when the pointer moves over an item, it is highlighted but not selected. When the user moves the pointer over a toolbar button, the button's appearance changes. You can use other window styles in combination with TBSTYLE_FLAT to produce toolbars that enable hot-tracking but have a different appearance from a flat toolbar. For more information, see Using Hot-tracking with Toolbars .

Using Toolbar Frames

Toolbar frames serve as containers for toolbars and other child windows. You implement toolbar frames by creating a rebar control and adding one or more controls to it. A rebar control hosts one or more bands. Each band contains only one child window.

Rebar controls are separate controls but they are often used to host toolbar controls. Using toolbar and rebar controls together enables you to write applications that are more flexible. For example, toolbars can be moved, repositioned, minimized, and maximized within the rebar control. For more information about programming rebar controls, see Rebar Controls .

Using Toolbar Controls

This section contains examples that demonstrate how to create and use toolbar controls in your applications.

  • Creating Toolbars
  • Creating Transparent Toolbars
  • Creating List-style Toolbars
  • Handling ToolTips
  • Handling Drop-down Buttons
  • Customizing Toolbars
  • Embedding Nonbutton Controls in Toolbars
  • Using Hot-tracking with Toolbars
  • Related Topics

Creating Toolbars

You can use two functions to create a toolbar— CreateWindowEx or CreateToolbarEx . This topic provides code samples using the two functions and also discusses several ways to add text to toolbar buttons.

Creating a Toolbar with CreateWindowEx

The following CreateAToolBar sample function uses CreateWindowEx and specifies the TOOLBARCLASSNAME window class to create an empty toolbar. To add buttons and button strings to the toolbar, the function uses TB_ADDSTRING and TB_ADDBUTTONS messages.

// CreateAToolBar creates a toolbar and adds a set of buttons to it.
// The function returns the handle to the toolbar if successful,
// or NULL otherwise.
// hwndParent is the handle to the toolbar's parent window.
HWND CreateAToolBar(HWND hwndParent)
{
   HWND hwndTB;
   TBADDBITMAP tbab;
   TBBUTTON tbb[3];
   char szBuf[16];
   int iCut, iCopy, iPaste;
   INITCOMMONCONTROLSEX icex;
   HRESULT hr;
   size_t cch;

// Ensure that the common control DLL is loaded.
   icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
   icex.dwICC  = ICC_BAR_CLASSES;
   InitCommonControlsEx(&icex);

// Create a toolbar.
   hwndTB = CreateWindowEx(0, TOOLBARCLASSNAME, (LPSTR) NULL,
        WS_CHILD | CCS_ADJUSTABLE, 0, 0, 0, 0, hwndParent,
        (HMENU) ID_TOOLBAR, g_hinst, NULL);

// Send the TB_BUTTONSTRUCTSIZE message, which is required for
// backward compatibility.
   SendMessage(hwndTB, TB_BUTTONSTRUCTSIZE, (WPARAM) sizeof(TBBUTTON), 0);

// Add the button strings to the toolbar's internal string list.
   LoadString(g_hinst, IDS_CUT, szBuf, MAX_LEN-1);
//Save room for second null terminator.
   hr = StringCchLength(szBuf, MAX_LEN, &cch);
   if(SUCCEEDED(hr))
   {
   szBuf[cch + 2] = 0;  //Double-null terminate.
   }
   else
   {
   // TODO: Write error handler.
   }
   iCut = SendMessage(hwndTB, TB_ADDSTRING, 0, (LPARAM) (LPSTR) szBuf);
   LoadString(g_hinst, IDS_COPY, szBuf, MAX_LEN-1);
//Save room for second null terminator.
   hr = StringCchLength(szBuf, MAX_LEN, &cch);
   if(SUCCEEDED(hr))
   {
   szBuf[cch + 2] = 0;  //Double-null terminate.
   }
   else
   {
   // TODO: Write error handler.
   }
   iCopy = SendMessage(hwndTB, TB_ADDSTRING, (WPARAM) 0,
       (LPARAM) (LPSTR) szBuf);
   LoadString(g_hinst, IDS_PASTE, szBuf, MAX_LEN-1);
//Save room for second null terminator.
   hr = StringCchLength(szBuf, MAX_LEN, &cch);
   if(SUCCEEDED(hr))
   {
   szBuf[cch + 2] = 0;  //Double-null terminate.
   }
   else
   {
   // TODO: Write error handler.
   }
   iPaste = SendMessage(hwndTB, TB_ADDSTRING, (WPARAM) 0,
        (LPARAM) (LPSTR) szBuf);

// Fill the TBBUTTON array with button information, and add the
// buttons to the toolbar. The buttons on this toolbar have text
// but do not have bitmap images.
   tbb[0].iBitmap = I_IMAGENONE;
   tbb[0].idCommand = IDS_CUT;
   tbb[0].fsState = TBSTATE_ENABLED;
   tbb[0].fsStyle = BTNS_BUTTON;
   tbb[0].dwData = 0;
   tbb[0].iString = iCut;

   tbb[1].iBitmap = I_IMAGENONE;
   tbb[1].idCommand = IDS_COPY;
   tbb[1].fsState = TBSTATE_ENABLED;
   tbb[1].fsStyle = BTNS_BUTTON;
   tbb[1].dwData = 0;
   tbb[1].iString = iCopy;

   tbb[2].iBitmap = I_IMAGENONE;
   tbb[2].idCommand = IDS_PASTE;
   tbb[2].fsState = TBSTATE_ENABLED;
   tbb[2].fsStyle = BTNS_BUTTON;
   tbb[2].dwData = 0;
   tbb[2].iString = iPaste;

   SendMessage(hwndTB, TB_ADDBUTTONS, (WPARAM) NUM_BUTTONS,
        (LPARAM) (LPTBBUTTON) &tbb);

   SendMessage(hwndTB, TB_AUTOSIZE, 0, 0);

   ShowWindow(hwndTB, SW_SHOW);
   return hwndTB;
}

Assigning text to a toolbar button

You are not required to make an internal list of strings to add text to a button. There are alternative methods. One alternative is to pass a string pointer to the iString member of a TBBUTTON structure. For example, you can place text in a buffer, retrieve a pointer to the buffer, enter the pointer in a TBBUTTON structure, and send a TB_ADDBUTTONS message, specifying the filled TBBUTTON structure.

tbb[0].iBitmap = -1;
tbb[0].idCommand = IDS_CUT;
tbb[0].fsState = TBSTATE_ENABLED;
tbb[0].fsStyle = TBSTYLE_BUTTON;
tbb[0].dwData = 0;
tbb[0].iString = (int) pszBuf;  // Text is in a buffer.

Another way to assign text to a button is with the TB_SETBUTTONINFO message. You enter the data you want to change in a TBBUTTONINFO structure. Then send a TB_SETBUTTONINFO message. The following example demonstrates how to modify the previous CreateAToolBar code to change the text of the third button from Paste to Change.

char szBuf[8] = "CHANGE";
LPSTR pszBuf;
TBBUTTONINFO tbi;
LPTBBUTTONINFO lptbbi;

// Other code here.
// Initialize pszBuf and lptbbi.

// These are the only fields of the TBBUTTONINFO structure that
// need to be changed to modify text.
    tbi.dwMask = TBIF_TEXT;
    tbi.cbSize = sizeof (TBBUTTONINFO);
    tbi.pszText = pszBuf;
    tbi.cchText = sizeof (szBuf);
SendMessage(hwndTB, TB_SETBUTTONINFO, IDS_PASTE, (LPARAM)
    (LPTBBUTTONINFO)lptbbi);

Note If you change a button's text by using TB_SETBUTTONINFO, this does not affect the string assigned to that button in the internal string list. Also, if you add a toolbar button string to the internal text list, you cannot retrieve the index of that string by calling TBN_GETBUTTONINFO ; you must use TB_GETBUTTON instead.

Creating a Toolbar with CreateToolbarEx

This example uses CreateToolbarEx to create a toolbar and adds standard bitmaps to the toolbar. The standard toolbar bitmaps are built into Comctl32.dll. You do not have to use the standard bitmaps; you can use your own custom bitmaps. To add a bitmap to an application, use the TB_ADDBITMAP message. The sample function, CreateAToolBar2, adds three standard file bitmaps and four standard view bitmaps. Because CreateAToolBar2 requires a TBBUTTON structure containing the predefined indexes to the bitmaps, you must include the following TBBUTTON structures in your application.

Show Example

// Toolbar buttons used to create the first 4 buttons.
TBBUTTON tbButtonsCreate [ ] =
{
{STD_FILENEW, IDM_NEW, TBSTATE_ENABLED, BTNS_BUTTON,
#if defined(_WIN32) | defined(_WIN64)
{0},
#endif
0L, 0},
{STD_FILEOPEN, IDM_OPEN, TBSTATE_ENABLED, BTNS_BUTTON,
#if defined(_WIN32) | defined(_WIN64)
{0},
#endif
0L, 0},
{STD_FILESAVE, IDM_SAVE, TBSTATE_ENABLED, BTNS_BUTTON,
#if defined(_WIN32) | defined(_WIN64)
{0},
#endif
0L, 0},
{0, 0, TBSTATE_ENABLED, BTNS_SEP,
#if defined(_WIN32) | defined(_WIN64)
{0},
#endif
0L, 0},
};

// Toolbar buttons to add.
TBBUTTON tbButtonsAdd [ ] =
{
{VIEW_LARGEICONS, IDM_LARGEICON, TBSTATE_ENABLED, BTNS_BUTTON,
#if defined(_WIN32) | defined(_WIN64)
{0},
#endif
0L, 0},
{VIEW_SMALLICONS, IDM_SMALLICON, TBSTATE_ENABLED, BTNS_BUTTON, #if defined(_WIN32) | defined(_WIN64)
{0},
#endif
0L, 0},
{VIEW_LIST, IDM_LISTVIEW, TBSTATE_ENABLED, BTNS_BUTTON, #if defined(_WIN32) | defined(_WIN64)
{0},
#endif
0L, 0},
{VIEW_DETAILS, IDM_REPORTVIEW, TBSTATE_ENABLED, BTNS_BUTTON, #if defined(_WIN32) | defined(_WIN64)
{0},
#endif
0L, 0},
};

// Also the code example uses a MACRO defined in the header file as
// follows: #define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))

// CreateAToolBar2 creates a toolbar and adds bitmaps to it.
// The function returns the handle to the toolbar if successful,
// or NULL otherwise.
// The function uses HINST_COMMCTRL as the HINSTANCE and
// IDB_STD_SMALL_COLOR as the bitmap identifier.
// hwndParent is the handle to the toolbar's parent window.
HWND CreateAToolBar2(HWND hWndParent)
{
HWND hWndToolbar;
TBADDBITMAP tb;
int index, stdidx;

// Create a toolbar with three standard file bitmaps and one
// separator.
// There are 15 items in IDB_STD_SMALL_COLOR.  However, because this is a
// standard system-defined bitmap, the parameter that specifies the number
// of button images in the bitmap (nBitmaps) is ignored, so it is set
// to 0.
hWndToolbar = CreateToolbarEx (hWndParent,
    WS_CHILD | WS_BORDER | WS_VISIBLE | TBSTYLE_TOOLTIPS,
    ID_TOOLBAR, 0, HINST_COMMCTRL, IDB_STD_SMALL_COLOR,
    tbButtonsCreate, ARRAYSIZE(tbButtonsCreate), 0, 0, 100, 30, sizeof (TBBUTTON));

// Add four view bitmaps. The view bitmaps are not in the same
// file as the standard bitmaps; therefore, you must change the
// resource identifier from IDB_STD_SMALL_COLOR to
// IDB_VIEW_SMALL_COLOR.
tb.hInst = HINST_COMMCTRL;
tb.nID = IDB_VIEW_SMALL_COLOR;
// There are 12 items in IDB_VIEW_SMALL_COLOR.  However, because this is a standard
// system-defined bitmap, wParam (nButtons) is ignored.
stdidx = SendMessage (hWndToolbar, TB_ADDBITMAP, 0, (LPARAM)&tb);

// Update the indexes to the view bitmaps.
for (index = 0; index < 4; index++)
tbButtonsAdd[index].iBitmap += stdidx;

// Add the view buttons.
SendMessage (hWndToolbar, TB_ADDBUTTONS, ARRAYSIZE(tbButtonsAdd), (LPARAM) &tbButtonsAdd[0]);

return hWndToolbar;
}

Creating Transparent Toolbars

Toolbar controls support a transparent look that allows the client area under the toolbar to show through. There are two kinds of transparent toolbars, ones with flat buttons and ones with three-dimensional buttons. If you want your application to match the Microsoft® Windows® interface, use the flat transparent style toolbar. You create a flat transparent toolbar by including the TBSTYLE_FLAT style. To create a nonflat transparent toolbar, use TBSTYLE_TRANSPARENT . The following illustration shows the two kinds of transparent toolbars. The flat transparent toolbar was created with the TBSTYLE_FLAT style; the nonflat transparent toolbar was created with the TBSTYLE_TRANSPARENT style.

To create a transparent toolbar, all you need to do is add TBSTYLE_FLAT or TBSTYLE_TRANSPARENT to the window style parameter of CreateToolbarEx . If you do not want a line to appear to indicate the bottom of the toolbar, do not use the WS_BORDER window style. The following code snippet shows a call to CreateToolbarEx that produces a transparent toolbar with flat buttons.

hWndToolbar = CreateToolbarEx (hWndParent,
    WS_CHILD | WS_VISIBLE | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT,
    ID_TOOLBAR, 11, (HINSTANCE)HINST_COMMCTRL, IDB_STD_SMALL_COLOR,
    (LPCTBBUTTON)&tbButtons, 4, 0, 0, 100, 30, sizeof (TBBUTTON));

To produce a transparent toolbar with raised buttons, change TBSTYLE_FLAT to TBSTYLE_TRANSPARENT.

Creating List-style Toolbars

Toolbar buttons enable you to display both text and bitmaps. The buttons on a toolbar created with the TBSTYLE_LIST style are different from other toolbar buttons because they place text to the right of the bitmap instead of under the image. Also, the list-style button leaves a blank space if you fail to provide images or text; other buttons do not. You can use the TBSTYLE_LIST toolbar style in combination with the TBSTYLE_FLAT style to create a toolbar with flat buttons. The following illustration shows two list-style toolbars that have buttons with both text and bitmaps. The list toolbar was created with the TBSTYLE_LIST style; the flat list toolbar was created with both the TBSTYLE_LIST and TBSTYLE_FLAT styles.

The following code snippet creates a toolbar with the TBSTYLE_LIST style.

hWndToolbar = CreateToolbarEx (hWndParent,
    WS_CHILD | WS_VISIBLE | TBSTYLE_TOOLTIPS | TBSTYLE_LIST,
    ID_TOOLBAR, 11, (HINSTANCE)HINST_COMMCTRL, IDB_STD_SMALL_COLOR,
    (LPCTBBUTTON)&tbButtons, 4, 0, 0, 100, 30, sizeof (TBBUTTON));

To create a flat list-style toolbar, use the following:

hWndToolbar = CreateToolbarEx (hWndParent,
    WS_CHILD | WS_VISIBLE | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT |
    TBSTYLE_LIST, ID_TOOLBAR, 11, (HINSTANCE)HINST_COMMCTRL,
    IDB_STD_SMALL_COLOR, (LPCTBBUTTON)&tbButtons, 4, 0, 0, 100,
    30, sizeof (TBBUTTON));

When you create a list-style toolbar, you should provide text and bitmaps to avoid blank spaces on the button. For information about adding text and bitmaps to a button, see Assigning text to a toolbar button and Defining Button Bitmaps.

Handling ToolTips

Applications that need to customize the text displayed in toolbar ToolTips must respond to the TTN_GETDISPINFO message sent by the toolbar control to its parent, rather than subclassing the toolbar control and intercepting the notification from the ToolTip to the toolbar. The method by which the toolbar and its associated ToolTip communicate varies from platform to platform.

A toolbar that has the TBSTYLE_TOOLTIPS style creates a ToolTip control, which an application can use to display Help text for toolbar buttons. The parent window receives the TTN_GETDISPINFO notification message when the toolbar needs the Help text for a button. The ToolTip control sends the notification in the form of a WM_NOTIFY message. The lParam parameter includes the address of an NMTTDISPINFO structure that specifies the command identifier of the button for which Help text is needed. An application can copy the Help text to the structure, specify the address of a string containing the Help text, or specify the instance handle and resource identifier of a string resource.

The following example specifies an instance handle and a resource identifier to handle the TTN_GETDISPINFO ToolTip notification.

Show Example

case WM_NOTIFY:
    switch (((LPNMHDR) lParam)->code)
    {
        case TTN_GETDISPINFO:
            {
            LPTOOLTIPTEXT lpttt;

            lpttt = (LPTOOLTIPTEXT) lParam;
            lpttt->hinst = g_hinst;

            // Specify the resource identifier of the descriptive
            // text for the given button.
            idButton = lpttt->hdr.idFrom;
            switch (idButton)
            {
                case IDM_CUT:
                    lpttt->lpszText = MAKEINTRESOURCE(IDS_TIPS_CUT);
                    break;
                case IDM_COPY:
                    lpttt->lpszText = MAKEINTRESOURCE(IDS_TIPS_COPY);
                    break;
                case IDM_PASTE:
                    lpttt->lpszText = MAKEINTRESOURCE(IDS_TIPS_PASTE);
                    break;
            }
            break;
            }
        .
        . // Process other notifications here.
        .
        default:
            break;
    }

If an application specifies labels in the iString member of the associated TBBUTTON structure, the toolbar control automatically uses that string as the ToolTip. You must send a TB_SETMAXTEXTROWS message and set the maximum text rows to zero to keep the label from appearing on the button. If your application does not respond to TTN_GETDISPINFO, the toolbar uses the label as the ToolTip text.

You can also provide ToolTips by using the TBSTYLE_EX_MIXEDBUTTONS extended style. This style allows you to set text for all buttons, but only display it for those buttons with the BTNS_SHOWTEXT button style. The TBSTYLE_LIST style must also be set. Normally, when a button does not display text, your application must handle TBN_GETINFOTIP to display a ToolTip. With the TBSTYLE_EX_MIXEDBUTTONS extended style, text that is set but not displayed on a button will automatically be used as the button's ToolTip text. Your application needs to handle TBN_GETINFOTIP only if it needs more flexibility in specifying the ToolTip text.

Handling Drop-down Buttons

A drop-down button is designed to present users with a list of options. You create this style button by specifying the BTNS_DROPDOWN style, also called TBSTYLE_DROPDOWN for compatibility with previous versions of the common controls. To produce a drop-down button with an arrow displayed on the right, you must specify BTNS_DROPDOWN and set the TBSTYLE_EX_DRAWDDARROWS toolbar style by sending a TB_SETEXTENDEDSTYLE message. The following illustration shows the two kinds of drop-down buttons. The toolbar with the drop-down button was created with the BTNS_DROPDOWN button style; the toolbar with the drop-down button and arrow was created with the BTNS_DROPDOWN button style and the TBSTYLE_EX_DRAWDDARROWS toolbar style.

When the user clicks a toolbar button that uses the BTNS_DROPDOWN style, the toolbar control sends its parent a TBN_DROPDOWN notification message. The application's notification handler can then display a list of options. When you click a drop-down arrow button, a TBN_DROPDOWN notification is sent; if you click the associated arrow, a WM_COMMAND message is sent.

An application can support a drop-down button in a toolbar control, as illustrated in the following DoNotify application-defined function:

  • If the incoming notification message is TBN_DROPDOWN, DoNotify retrieves the bounding rectangle of the button the user clicked by sending the TB_GETRECT message.
  • When sending the message, DoNotify specifies the command identifier of the drop-down button as the wParam parameter of the SendMessage function.
  • The button's command identifier was retrieved from the iItem member of the NMTOOLBAR structure that lParam points to.
  • After DoNotify retrieves the bounding rectangle, it calls MapWindowPoints to convert the rectangle from client coordinates to screen coordinates.
  • It then retrieves the pop-up menu from a menu resource by using the GetSubMenu function and calls the TrackPopupMenuEx function to display the menu.
  • Note that DoNotify positions the menu under the correct button by using the rectangle it retrieved earlier. It also includes the TPM_VERTICAL flag to ensure that the menu is displayed so that it doesn't overlap the button.
  • Note also that DoNotify sets rcExclude equal to the button rectangle so that if the toolbar is too close to the bottom of the screen, the menu will appear above the button rather than below it.

BOOL DoNotify(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
#define lpnm   ((LPNMHDR)lParam)
#define lpnmTB ((LPNMTOOLBAR)lParam)

   RECT      rc;
   TPMPARAMS tpm;
   HMENU     hPopupMenu = NULL;
   HMENU     hMenuLoaded;
   BOOL      bRet = FALSE;

   switch(lpnm->code){
      case TBN_DROPDOWN:
         SendMessage(lpnmTB->hdr.hwndFrom, TB_GETRECT,
                     (WPARAM)lpnmTB->iItem, (LPARAM)&rc);

         MapWindowPoints(lpnmTB->hdr.hwndFrom,
                         HWND_DESKTOP, (LPPOINT)&rc, 2);

         tpm.cbSize = sizeof(TPMPARAMS);
         tpm.rcExclude = rc;
         hMenuLoaded = LoadMenu(g_hinst, MAKEINTRESOURCE(IDR_POPUP));
         hPopupMenu = GetSubMenu(LoadMenu(g_hinst,
            MAKEINTRESOURCE(IDR_POPUP)),0);

         TrackPopupMenuEx(hPopupMenu,
            TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_VERTICAL,
            rc.left, rc.bottom, g_hwndMain, &tpm);

         DestroyMenu(hMenuLoaded);
      return (FALSE);
   }
   return FALSE;
}

Customizing Toolbars

Most Windows-based applications use toolbar controls to provide their users with convenient access to various tools. However, static toolbars have some shortcomings, such as too little space to effectively display all the available tools.

The solution to this problem is to make your application's toolbars customizable. Users can then move, add, and delete tools to select only the ones they need and organize them in whatever way they find convenient.

To enable customization, include the CCS_ADJUSTABLE common controls style flag when you create the toolbar control. There are two basic approaches to customization:

  • The customization dialog box. This system-provided dialog box is the simplest approach. It gives users a graphical user interface that allows them to add, delete, or move icons.
  • Dragging and dropping tools. Implementing drag and drop allows users to move tools to another location on the toolbar or delete them by dragging them off the toolbar. It provides users a quick and easy way to organize their toolbar, but does not allow them to add tools.

You can implement either or both, depending on the needs of the application. Neither of these two approaches to customization provides a built-in mechanism, such as a Cancel or Undo button, to return the toolbar to its former state. You must explicitly use the toolbar control API to store the toolbar's precustomization state. If necessary, you can later use this stored information to restore the toolbar to its original state.

This topic discusses how to enable toolbar customization with the customization dialog box and with drag and drop.

Customization Dialog Box

The customization dialog box is provided by the toolbar control to give users a simple way to add, move, or delete tools. Users can launch it by double-clicking the toolbar. Applications can launch the customization dialog box by sending the toolbar control a TB_CUSTOMIZE message. The following illustration shows an example of the toolbar customization dialog box.

The tools in the right-hand list box are those currently on the toolbar. Initially, this list will contain the tools that you specify when you create the toolbar. The left-hand list box contains the tools that are available to add to the toolbar. Your application is responsible for populating that list and keeping track of what tools are currently on the toolbar.

Implementing the customization dialog box

The toolbar control notifies your application that it is launching a customization dialog box by sending its parent window a TBN_BEGINADJUST notification. It then sends a TBN_INITCUSTOMIZE notification. If you don't want the toolbar to display a Help button, handle this notification and return TBNRF_HIDEHELP.

The toolbar control then collects the information it needs to initialize the dialog box by sending three series of notifications in the following order:

  • A TBN_QUERYINSERT notification for each button on the toolbar to determine where buttons can be inserted. Return FALSE to prevent a button from being inserted to the left of the button specified in the notification. If you return FALSE to all TBN_QUERYINSERT notifications, the dialog box will not be displayed.
  • A TBN_QUERYDELETE notification for each tool currently on the toolbar. Return TRUE if a tool can be deleted, or FALSE if not.
  • A series of TBN_GETBUTTONINFO notifications to populate the list of available tools. To add a tool to the list, fill in the NMTOOLBAR structure that is passed with the notification and return TRUE. When you have no more tools to add, return FALSE.

The dialog box is then displayed, and the user can begin to customize the toolbar.

Once the dialog box is displayed, your application can receive a variety of notifications, depending on the users' actions:

  • TBN_QUERYINSERT. Each time the user changes the location of a tool on the toolbar, or adds a tool. Return FALSE to prevent the tool from being inserted at that location.
  • TBN_DELETINGBUTTON . The user is about to remove a tool from the toolbar.
  • TBN_CUSTHELP . The user has clicked the Help button.
  • TBN_TOOLBARCHANGE . The user has added, moved, or deleted a tool.
  • TBN_RESET . The user has clicked the Reset button.

After the dialog box is destroyed, your application will receive a TBN_ENDADJUST notification.

The following code example demonstrates how to handle notifications to enable toolbar customization.

Show Example

LRESULT MsgNotify(HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
{
    static UINT		i=0;
    LPNMHDR         lpnmhdr;

    lpnmhdr = (LPNMHDR)lparam;

    // The following code allows the toolbar to be customized.
    // If you return FALSE the Customize Toolbar dialog flashes
    // and goes away.

    if (lpnmhdr->code == TBN_QUERYINSERT || lpnmhdr->code ==
        TBN_QUERYDELETE)
    {
     return TRUE;
    }

    if (lpnmhdr->code == TBN_GETBUTTONINFO)
    {
        LPTBNOTIFY lpTbNotify = (LPTBNOTIFY)lparam;
        char  szBuffer [20];

        // 20 = total number of buttons.
        // tbButton and tbButtonNew send information about
        // the other 12 buttons in tbButtonNew.

        if (lpTbNotify->iItem < 12)
        {
         lpTbNotify->tbButton = tbButtonNew[lpTbNotify->iItem];
         LoadString(hInst,
                    4000+ lpTbNotify->iItem,
                    szBuffer, sizeof(szBuffer)/sizeof(szBuffer[0]));
         hr = StringCchCopy
                  (lpTbNotify->pszText,
                          sizeof(lpTbNotify->pszText)
                          /sizeof(lpTbNotify->pszText[0]),
                          szBuffer );
                        if(SUCEEDED(hr))
                          {
                          lpTbNotify->cchText =
                               sizeof(szBuffer)/sizeof(szBuffer[0]);
                          }
                        else
                          {
                          TODO: Write error handler.
                          }
         return TRUE;
        }
     else
        return 0;
    }
    return 0;
}

Dragging and Dropping Tools

Users can also rearrange the buttons on a toolbar by pressing the SHIFT key and dragging the button to another location. The drag-and-drop process is handled automatically by the toolbar control. It displays a ghost image of the button as it is dragged, and rearranges the toolbar after it is dropped. Users cannot add buttons in this way, but they can delete a button by dropping it off the toolbar.

Although the toolbar control normally does this operation automatically, it also sends your application two notifications: TBN_QUERYDELETE and TBN_QUERYINSERT. To control the drag-and-drop process, handle these notifications as follows:

  • The TBN_QUERYDELETE notification is sent as soon as the user attempts to move the button, before the ghost button is displayed. Return FALSE to prevent the button from being moved. If you return TRUE, the user will be able to either move the tool or delete it by dropping it off the toolbar. Once you have allowed the user to move a tool, you cannot prevent him or her from deleting it. However, if the user deletes a tool, the toolbar control will send your application a TBN_DELETINGBUTTON notification, at which point you can choose to reinsert the button at its original location, thereby canceling the deletion.
  • The TBN_QUERYINSERT notification is sent when the user attempts to drop the button on the toolbar. To prevent the button being moved from being dropped to the left of the button specified in the notification, return FALSE. This notification is not sent if the user drops the tool off the toolbar.

If the user attempts to drag a button without also pressing the SHIFT key, the toolbar control will not handle the drag-and-drop operation. However, it will send your application a TBN_BEGINDRAG notification to indicate the start of a drag operation, and a TBN_ENDDRAG notification to indicate the end. If you want to enable this form of drag-and-drop, your application must handle these notifications, provide the necessary user interface, and modify the toolbar to reflect any changes.

Saving and Restoring Toolbars

In the process of customizing a toolbar, your application might need to save information so that you can restore the toolbar to its original state. To initiate saving or restoring a toolbar state, send the toolbar control a TB_SAVERESTORE message with the lParam set to TRUE. The lParam value of this message specifies whether you are requesting a save or a restore operation. Once the message is sent, there are two ways to handle the save/restore operation:

  • With common controls version 4.72 and earlier, you must implement a TBN_GETBUTTONINFO handler. The toolbar control sends this notification to request information about each button as it is restored.
  • Version 5.80 includes a save/restore option. At the beginning of the process, and as each button is saved or restored, your application will receive a TBN_SAVE or TBN_RESTORE notification. To use this option, you must implement notification handlers to provide the Shell with the bitmap and state information it needs to successfully save or restore the toolbar state.

Toolbar states are saved in a data stream that consists of blocks of Shell-defined data alternating with blocks of application-defined data. One data block of each type is stored for each button, along with an optional block of global data that applications can place at the beginning of the stream. During the save process, your TBN_SAVE handler adds the application-defined blocks to the data stream. During the restore process, the TBN_RESTORE handler reads each block and gives the Shell the information it needs to reconstruct the toolbar.

How to Handle a TBN_SAVE Notification

The first TBN_SAVE notification is sent at the beginning of the save process. Before any buttons are saved, the members of the NMTBSAVE structure are set as shown in the following table.

Member | Setting
iItem | -1
cbData | Amount of memory needed for Shell-defined data.
cButtons | Number of buttons.
pData | Calculated amount of memory needed for application-defined data. Typically, you include some global data, plus data for each button. Add that value to cbData and allocate enough memory to pData to hold it all.
pCurrent | First unused byte in the data stream. If you do not require global toolbar information, set pCurrent = pData so that it points to the start of the data stream. If you do require global toolbar information, store it at pData, then set pCurrent to the beginning of the unused portion of the data stream before returning.

If you want to add some global toolbar information, put it at the start of the data stream. Advance pCurrent to the end of the global data so that it points to the beginning of the unused portion of the data stream, and return.

After you return, the Shell starts saving button information. It adds the Shell-defined data for the first button at pCurrent and then advances pCurrent to the start of the unused portion.

After each button is saved, a TBN_SAVE notification is sent and NMTBSAVE is returned with these members set as follows.

Member | Setting
iItem | Zero-based index of the button number.
pCurrent | Pointer to the first unused byte in the data stream. If you want to store additional information about the button, store it at the location pointed to by pCurrent and update pCurrent to point to the first unused portion of the data stream after that.
TBBUTTON | TBBUTTON structure that describes the button being saved.

When you receive the notification, you should extract any button-specific information you need fromTBBUTTON. Remember that when you add a button, you can use the dwData member of TBBUTTON to hold application-specific data. Load your data into the data stream at pCurrent. Advance pCurrent to the end of your data, again pointing to the beginning of the unused portion of the stream, and return.

The Shell then goes to the next button, adds its information to pData, advances pCurrent, loads TBBUTTON, and sends another NMTBSAVE notification. This process continues until all buttons are saved.

Restoring Saved Toolbars

The restore process basically reverses the save process. At the beginning, your application will receive a NMTBRESTORE notification with the iItem member of the NMTBRESTORE structure set to -1. The cbData member is set to the size ofpData, and cButtons is set to the number of buttons.

Your notification handler should extract the global information placed at the beginning of pData during the save, and advance pCurrent to the start of the first block of Shell-defined data. Set cBytesPerRecord to the size of the data blocks you used to save the button data. Set cButtons to the number of buttons, and return.

The next NMTBRESTORE is for the first button. The pCurrent member points to the start of your first block of button data, and iItem is to the button index. Extract that data and advance pCurrent. Load the data into TBBUTTON, and return. To omit a button from the restored toolbar, set the idCommand member of TBBUTTON to zero. The Shell will repeat the process for the remaining buttons.

In addition to NMTBSAVE and NMTBRESTORE messages, you can also use messages such as TBN_RESET to save and restore a toolbar. The following code snippet saves a toolbar before it is customized and restores it if the application receives a TBN_RESET message.

int                    i;
LPNMHDR                lpnmhdr;
static int             nResetCount;
static LPTBBUTTON      lpSaveButtons;
LPARAM                 lParam;

switch( lpnmhdr->code)
{
   case TBN_BEGINADJUST: // Start customizing the toolbar.
     {
       LPTBNOTIFY  lpTB = (LPTBNOTIFY)lparam;

       // Allocate memory to store the button information.
       nResetCount = SendMessage(lpTB->hdr.hwndFrom,
         TB_BUTTONCOUNT, 0, 0);
       lpSaveButtons = (LPTBBUTTON)GlobalAlloc(GPTR,
         sizeof(TBBUTTON) * nResetCount);

      // Save the current configuration so if the user presses
      // reset, the original toolbar can be restored.
      for(i = 0; i < nResetCount; i++)
         {
         SendMessage(lpTB->hdr.hwndFrom, TB_GETBUTTON, i,
            (LPARAM)(lpSaveButtons + i));
         }
     }
     return TRUE;

   case TBN_RESET:
      {
      LPTBNOTIFY  lpTB = (LPTBNOTIFY)lparam;
      int         nCount, i;

      // Remove all of the existing buttons starting with the
      // last and working down.
      nCount = SendMessage(lpTB->hdr.hwndFrom, TB_BUTTONCOUNT, 0,
         0);
      for(i = nCount - 1; i >= 0; i--)
         {
         SendMessage(lpTB->hdr.hwndFrom, TB_DELETEBUTTON, i, 0);
         }

      // Restore the buttons that were saved.
      SendMessage(lpTB->hdr.hwndFrom, TB_ADDBUTTONS,
        (WPARAM)nResetCount, (LPARAM)lpSaveButtons);
      }
      return TRUE;

   case TBN_ENDADJUST:
      // Free the memory allocated during TBN_BEGINADJUST
      GlobalFree((HGLOBAL)lpSaveButtons);
      return TRUE;
 }

Embedding Nonbutton Controls in Toolbars

Toolbars support only buttons; therefore, if your application requires a different kind of control, you must create a child window. The following illustration shows a toolbar with an embedded edit control.

Any type of window can be placed on a toolbar. The following sample code adds an edit control as a child of the toolbar control window. Because the toolbar is created and then the edit control added, you must provide space for the edit control. One way to do this is to add a separator as a placeholder in the toolbar. For example, to add an edit control to the second code sample in the Creating Toolbars section of this article, you first add a separator to tbButtonsCreate, a customized TBBUTTON structure. You set the width of the separator to the number of pixels you want to reserve.

The following application-defined function creates the toolbar, and adds the buttons and the edit control.

HWND CreateAToolBar(HWND hWndParent)
{
HWND hWndToolbar;
HWND hWndEdit;
TBADDBITMAP tb;
int index, stdidx;
int cx_edit, CX_SEPARATOR = 250; // Width of edit control.
int cy_edit = 35;                // Height of edit control.

// The code example uses a MACRO defined in the header file as
// follows: #define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))

// Toolbar buttons

TBBUTTON tbButtonsCreate [ ] =
{
// The separator is set to the width of the edit control.
{CX_SEPARATOR, 0, TBSTATE_ENABLED, BTNS_SEP,
#if defined(_WIN32) | defined(_WIN64)
{0},
#endif
0, -1},
{STD_FILENEW, IDM_NEW, TBSTATE_ENABLED, BTNS_BUTTON,
#if defined(_WIN32) | defined(_WIN64)
{0},
#endif
0L, 0},
{STD_FILEOPEN, IDM_OPEN, TBSTATE_ENABLED, BTNS_BUTTON,
#if defined(_WIN32) | defined(_WIN64)
{0},
#endif
0L, 0},
{STD_FILESAVE, IDM_SAVE, TBSTATE_ENABLED, BTNS_BUTTON,
#if defined(_WIN32) | defined(_WIN64)
{0},
#endif
0L, 0},
{0, 0, TBSTATE_ENABLED, BTNS_SEP,
#if defined(_WIN32) | defined(_WIN64)
{0},
#endif
0L, 0},
};

TBBUTTON tbButtonsAdd [ ] =
{
{VIEW_LARGEICONS, IDM_LARGEICON, TBSTATE_ENABLED, BTNS_BUTTON,
#if defined(_WIN32) | defined(_WIN64)
{0},
#endif
0L, 0},
{VIEW_SMALLICONS, IDM_SMALLICON, TBSTATE_ENABLED, BTNS_BUTTON,
#if defined(_WIN32) | defined(_WIN64)
{0},
#endif
0L, 0},
{VIEW_LIST, IDM_LISTVIEW, TBSTATE_ENABLED, BTNS_BUTTON,
#if defined(_WIN32) | defined(_WIN64)
{0},
#endif
0L, 0},
{VIEW_DETAILS, IDM_REPORTVIEW, TBSTATE_ENABLED, BTNS_BUTTON,
#if defined(_WIN32) | defined(_WIN64)
{0},
#endif
0L, 0},
};
// Create a toolbar containing separators and three buttons.
// There are 15 items in IDB_STD_SMALL_COLOR.  However, because this is a
// standard system-defined bitmap, the parameter that specifies the number
// of button images in the bitmap (nBitmaps) is ignored, so it is set
// to 0.
hWndToolbar = CreateToolbarEx (hWndParent,
    WS_CHILD | WS_BORDER | WS_VISIBLE | TBSTYLE_TOOLTIPS,
    ID_TOOLBAR, 0, HINST_COMMCTRL,
    IDB_STD_SMALL_COLOR, tbButtonsCreate, ARRAYSIZE(tbButtonsCreate), 0, 0, 100,
    30, sizeof (TBBUTTON));

// Add four view bitmaps. The view bitmaps are not in the same
// file as the standard bitmaps; therefore, you must change the
// resource identifier to IDB_VIEW_SMALL_COLOR.
tb.hInst = HINST_COMMCTRL;
tb.nID = IDB_VIEW_SMALL_COLOR;
// There are 12 items in IDB_VIEW_SMALL_COLOR.  However, because this is a standard
// system-defined bitmap, wParam (nButtons) is ignored.
stdidx = SendMessage (hWndToolbar, TB_ADDBITMAP, 0,
   (LPARAM)&tb);

// Update the indexes to the view bitmaps.
for (index = 0; index < 4; index++)
   tbButtonsAdd[index].iBitmap += stdidx;

// Add the view buttons.
SendMessage (hWndToolbar, TB_ADDBUTTONS, ARRAYSIZE(tbButtonsAdd), (LPARAM)
   &tbButtonsAdd[0]);

// Create the edit control child window.
hWndEdit = CreateWindowEx(0L, "Edit", NULL, WS_CHILD | WS_BORDER
   | WS_VISIBLE | ES_LEFT | ES_AUTOVSCROLL | ES_MULTILINE,
   0, 0, cx_edit, cy_edit, hWndToolbar, (HMENU) IDM_EDIT, hInst, 0 );

// Return the toolbar with the embedded edit control.
return hWndToolbar;
}

The sample hard-codes the dimensions of the child window; however, to make a more robust application, determine the size of the toolbar and make the edit control window to fit.

You might want the edit control notifications to go to another window, such as the toolbar's parent. To do this, create the edit control as a child of the toolbar's parent window. Then change the parent of the edit control to the toolbar. Notifications go to the original parent; therefore, the edit control messages go to the parent of the toolbar and yet the edit window resides in the toolbar window. The following code example demonstrates this.

// Create the edit control. Notice that hWndParent, parent of
// the toolbar, is used as the parent of the edit control.
hWndEdit = CreateWindowEx(0L, "Edit", NULL, WS_CHILD | WS_BORDER
   | WS_VISIBLE | ES_LEFT | ES_AUTOVSCROLL | ES_MULTILINE,
   0, 0, cx_edit, cy_edit, hWndParent, (HMENU) IDM_EDIT, hInst, 0 );

// Set the toolbar window as the parent of the edit control
// window. You must set the toolbar as the parent of the edit
// control for it to appear embedded in the toolbar.
SetParent (hWndEdit, hWndToolbar);

Using Hot-tracking with Toolbars

When a mouse pointer hovers over an item, the item becomes hot. If hot-tracking is enabled, the hot item is selected and the item under the mouse pointer is highlighted. Hot-tracking is supported by common controls, such as the toolbar, list view, tab, and header. Some controls have window styles that provide hot-tracking by default; others require that a specific hot-tracking window style be used. A toolbar created with the TBSTYLE_FLAT style supports hot-tracking by default. You can use TBSTYLE_FLAT in combination with other window styles to produce toolbars that enable hot-tracking. Hot-tracking requires that you create image lists; therefore, you cannot use TB_ADDBITMAP or CreateToolbarEx to create your toolbar.

When the mouse hovers over a toolbar button, the button is outlined to highlight it. The following illustration shows a flat or transparent toolbar with hot-tracking enabled.

If you want a toolbar button bitmap to change when the state of the control changes, store the different images in Image Lists . For example, some applications have black and white toolbar buttons that become colored when they are selected. The two different images are stored in image lists. Toolbars support using up to three image lists. Typically an application has a default, disabled, and hot-tracking list of images. To set and retrieve image lists for hot toolbar buttons, use TB_SETHOTIMAGELIST and TB_GETHOTIMAGELIST . The following code snippet creates, fills, and assigns an image list for hot buttons.

// Create the image list, himlHot.
himlHot = ImageList_Create(MYICON_CX,MYICON_CY,ILC_COLOR8,0,4);
// Load a bitmap from a resource file and adds the images to the
// image list. The bitmap contains four images.
   hBitmapHot = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDB_HOT));
   ImageList_Add(himlHot, hBitmapHot, NULL);

// Set the image list.
   SendMessage(hwndTB, TB_SETHOTIMAGELIST, 0, (LPARAM)himlHot);

// Loop to fill the array of TBBUTTON structures.
   for(i=0;i<MAX_BUTTONS;i++)
   {
      tbArray[i].iBitmap   = i; // Bitmap from image list.
      tbArray[i].idCommand = IDM_BUTTONSTART + i;
      tbArray[i].fsState   = TBSTATE_ENABLED;
      tbArray[i].fsStyle   = BTNS_DROPDOWN;
      tbArray[i].dwData    = 0;
      tbArray[i].iString   = i;
   }
// Delete the loaded bitmap.
DeleteObject(hBitmapHot);

© 2002 Microsoft Corporation. All rights reserved.


About ToolTip Controls

ToolTips are hidden most of the time. They appear automatically, or pop up, when the user pauses the mouse pointer over a tool. The ToolTip appears near the pointer and disappears when the user clicks a mouse button or moves the pointer away from the tool.

  • ToolTip Behavior and Appearance
  • Creating ToolTip Controls
  • Activating ToolTip Controls
  • Supporting Tools
  • Displaying Text
  • Messaging and Notification
  • Hit Testing
  • Default Message Processing

ToolTip Behavior and Appearance

ToolTip controls can display a single line of text or multiple lines. Their corners can be rounded or square. They might or might not have a stem that points to the tools like a cartoon balloon. ToolTip text can be stationary or can move with the mouse pointer, called tracking. Stationary text can be displayed adjacent to a tool or it can be displayed over a tool, which is referred to as in-place. Standard ToolTips are stationary, display a single line of text, have square corners, and have no stem pointing to the tool.

Tracking ToolTips, which are supported by version 4.70 of the common controls, change position on the screen dynamically. By rapidly updating the position, these ToolTip controls appear to move smoothly, or "track." These are useful when you want ToolTip text to follow the position of the mouse pointer as it moves. For more information about tracking ToolTips and an example with code that shows how you create them, see Tracking ToolTips .

Multiline ToolTips, which are also supported by version 4.70 of the common controls, display text on more than one line. These are useful for displaying lengthy messages. For more information and an example that shows how to create multiline ToolTips, see Multiline ToolTips .

Balloon ToolTips are displayed in a cartoon-style "balloon," with rounded corners and a stem pointing to the tool. They can be either single-line or multiline. The following illustration shows a multiline balloon ToolTip with the stem and rectangle in their default positions. For more information about balloon ToolTips and an example that shows how you create them, see Balloon ToolTips .

Sometimes text strings that are long enough to display useful information get clipped because they are too long to be displayed completely in a small window or frame. This diminishes the usefulness of the text strings. In-place ToolTips are used to display text strings for objects that have been clipped, such as the folder names shown on the right in the following graphic. For an example that shows how to create in-place ToolTips, see In-Place ToolTips .

The cursor must hover over a tool for a period of time before the ToolTip is displayed. The default duration of this timeout is controlled by the user's double click time and is typically about one-half second. To specify a non-default timeout value, send the ToolTip control a TTM_SETDELAYTIME message.

Creating ToolTip Controls

To create a ToolTip control, call CreateWindowEx and specify the TOOLTIPS_CLASS window class. This class is registered when the common control dynamic-link library (DLL) is loaded. To ensure that this DLL is loaded, include the InitCommonControlsEx function in your application. You must explicitly define a ToolTip control as topmost. Otherwise, it might be covered by the parent window. The following code fragment shows how to create a ToolTip control.

HWND hwndTip = CreateWindowEx(NULL, TOOLTIPS_CLASS, NULL,
                            WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
                            CW_USEDEFAULT, CW_USEDEFAULT,
                            CW_USEDEFAULT, CW_USEDEFAULT,
                            hwndParent, NULL, hinstMyDll,
                            NULL);

SetWindowPos(hwndTip, HWND_TOPMOST,0, 0, 0, 0,
             SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);

The window procedure for the ToolTip control automatically sets the size, position, and visibility of the control. The height of the ToolTip window is based on the height of the font currently selected into the device context for the ToolTip control. The width varies based on the length of the string currently in the ToolTip window.

Activating ToolTip Controls

A ToolTip control can be either active or inactive. When it is active, the ToolTip text appears when the mouse pointer is on a tool. When it is inactive, the ToolTip text does not appear, even if the pointer is on a tool. The TTM_ACTIVATE message activates and deactivates a ToolTip control.

Supporting Tools

A ToolTip control can support any number of tools. To support a particular tool, you must register the tool with the ToolTip control by sending the control the TTM_ADDTOOL message. The message includes the address of a TOOLINFO structure, which provides information the ToolTip control needs to display text for the tool. The uID member of the TOOLINFO structure is defined by the application. Each time you add a tool, your application provides a unique identifier. The cbSize member of the TOOLINFO structure is required, and must specify the size of the structure.

A ToolTip control supports tools implemented as windows (such as child windows or control windows) and as rectangular areas within a window's client area. When you add a tool implemented as a rectangular area, the hwnd member of the TOOLINFO structure must specify the handle to the window that contains the area, and the rect member must specify the client coordinates of the area's bounding rectangle. In addition, the uID member must specify the application-defined identifier for the tool.

When you add a tool implemented as a window, the uID member of the TOOLINFO structure must contain the window handle to the tool. Also, the uFlags member must specify the TTF_IDISHWND value, which tells the ToolTip control to interpret the uID member as a window handle.

Displaying Text

When you add a tool to a ToolTip control, the lpszText member of the TOOLINFO structure must specify the address of the string to display for the tool. After you add a tool, you can change the text using the TTM_UPDATETIPTEXT message.

If the high-order word of lpszText is zero, the low-order word must be the identifier of a string resource. When the ToolTip control needs the text, the system loads the specified string resource from the application instance identified by the hinst member of the TOOLINFO structure.

If you specify the LPSTR_TEXTCALLBACK value in the lpszText member, the ToolTip control notifies the window specified in the hwnd member of the TOOLINFOstructure whenever the ToolTip control needs to display text for the tool. The ToolTip control sends the TTN_GETDISPINFO notification message to the window. The message includes the address of a NMTTDISPINFO structure, which contains the window handle as well as the application-defined identifier for the tool. The window examines the structure to determine the tool for which text is needed, and it fills the appropriate structure members with information that the ToolTip control needs in order to display the string.

Note The maximum length for standard ToolTip text is 80 characters. For more information, see the NMTTDISPINFO structure. Multiline ToolTip text can be longer.

Many applications create toolbars containing tools that correspond to menu commands. For such tools, it is convenient for the ToolTip control to display the same text as the corresponding menu item. The system automatically strips the ampersand (&) accelerator characters from all strings passed to a ToolTip control, unless the control has the TTS_NOPREFIX style.

To retrieve the text for a tool, use the TTM_GETTEXT message.

Messaging and Notification

ToolTip text is normally displayed when the mouse pointer hovers over an area, typically the rectangle defined by a tool such as a button control. However, Microsoft® Windows® only sends mouse-related messages to the window that contains the pointer, not the ToolTip control itself. Mouse-related information must be relayed to the ToolTip control in order for it to display the ToolTip text at the appropriate time and place.

You can have messages relayed automatically if:

  • The tool is a control or is defined as a rectangle in the tool's TOOLINFO structure.
  • The window associated with the tool is in the same thread as the ToolTip control.

If these two conditions are met, set the TTF_SUBCLASS flag in the uFlags member of the tool's TOOLINFO structure when you add the tool to the ToolTip control with TTM_ADDTOOL. The necessary mouse messages then will be relayed automatically to the ToolTip control.

Setting TTF_SUBCLASS to have mouse messages relayed to the control is sufficient for most purposes.However, it will not work in cases where there is no direct connection between the ToolTip control and the tool's window. For example, if a tool is implemented as a rectangular area in an application-defined window, the window procedure receives the mouse messages. Setting TTF_SUBCLASS is sufficient to ensure that they are passed to the control. However, if a tool is implemented as a system-defined window, mouse messages are sent to that window and are not directly available to the application. In this case, you must either subclass the window or use a message hook to access the mouse messages. You must then explicitly relay mouse messages to the ToolTip control with TTM_RELAYEVENT . For an example of how to use TTM_RELAYEVENT, see Tracking ToolTips .

When a ToolTip control receives a WM_MOUSEMOVE message, it determines whether the mouse pointer is in the bounding rectangle of a tool. If it is, the ToolTip control sets a timer. At the end of the time-out interval, the ToolTip control checks the position of the pointer to see if it has moved. If it hasn't, the ToolTip control retrieves the text for the tool and displays the ToolTip. The ToolTip control continues to show the window until it receives a relayed button-up or button-down message or until a WM_MOUSEMOVE message indicates that the pointer has moved outside the bounding rectangle of the tool.

A ToolTip control actually has three time-out durations associated with it. The initial duration is the length of time that the mouse pointer must remain stationary within the bounding rectangle of a tool before the ToolTip window is displayed. The reshow duration is the length of the delay before subsequent ToolTip windows are displayed when the pointer moves from one tool to another. The pop-up duration is the length of time that the ToolTip window remains displayed before it is hidden. That is, if the pointer remains stationary within the bounding rectangle afterthe ToolTip window is displayed, the ToolTip window is automatically hidden at the end of the pop-up duration. You can adjust all of the time-out durations by using the TTM_SETDELAYTIME message.

If an application includes a tool implemented as a rectangular area and the size or position of the control changes, the application can use the TTM_NEWTOOLRECT message to report the change to the ToolTip control. An application does not need to report size and position changes for a tool implemented as a window because the ToolTip control uses the tool's window handle to determine if the mouse pointer is on the tool, not the tool's bounding rectangle.

When a ToolTip is about to be displayed, the ToolTip control sends the owner window a TTN_SHOW notification message. The owner window receives a TTN_POP notification when a ToolTip is about to be hidden. Each notification is sent in the context of a WM_NOTIFY message.

Hit Testing

The TTM_HITTEST message allows you to retrieve information that a ToolTip control maintains about the tool occupying a particular point. The message includes a TTHITTESTINFO structure that contains a window handle, the coordinates of a point, and the address of a TOOLINFO structure. The ToolTip control determines whether a tool occupies the point and, if it does, fills TOOLINFO with information about the tool.

Default Message Processing

The following table describes the messages handled by the window procedure for the ToolTip control.

Message | Description
WM_CREATE | Ensures that the ToolTip control has the WS_EX_TOOLWINDOW and WS_POPUP window styles. It also allocates memory and initializes internal variables.
WM_DESTROY | Frees resources allocated for the ToolTip control.
WM_GETFONT | Returns the handle of the font that the ToolTip control will use to draw text.
WM_MOUSEMOVE | Hides the ToolTip window.
WM_PAINT | Draws the ToolTip window.
WM_SETFONT | Sets the handle of the font that the ToolTip control will use to draw text.
WM_TIMER | Hides the ToolTip window if the tool has changed position or if the mouse pointer has moved outside the tool. Otherwise, it shows the ToolTip window.
WM_WININICHANGE | Resets internal variables that are based on system metrics.

Using ToolTip Controls

This section contains examples that demonstrate how to create different types of ToolTips.

  • ToolTips for Rectangular Areas
  • Tracking ToolTips
  • Multiline ToolTips
  • Balloon ToolTips
  • In-Place ToolTips

ToolTips for Rectangular Areas

The following example demonstrates how to create a standard ToolTip control and add a tool to it. The example creates a rectangular area, which consists of a window's entire client area, and then uses the TTM_ADDTOOL message to add a ToolTip control to the rectangular area. The TTF_SUBCLASS flag is set in the uFlags member of the TOOLINFO structure to have mouse messages automatically passed to the ToolTip control.

/* CREATE A TOOLTIP CONTROL OVER THE ENTIRE WINDOW AREA */
void CreateMyTooltip (HWND hwnd)
{
                 // struct specifying control classes to register
    INITCOMMONCONTROLSEX iccex;
    HWND hwndTT;                 // handle to the ToolTip control
          // struct specifying info about tool in ToolTip control
    TOOLINFO ti;
    unsigned int uid = 0;       // for ti initialization
    char strTT[30] = "This is your ToolTip string.";
    LPTSTR lptstr = strTT;
    RECT rect;                  // for client area coordinates

    /* INITIALIZE COMMON CONTROLS */
    iccex.dwICC = ICC_WIN95_CLASSES;
    iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);
    InitCommonControlsEx(&iccex);

    /* CREATE A TOOLTIP WINDOW */
    hwndTT = CreateWindowEx(WS_EX_TOPMOST,
        TOOLTIPS_CLASS,
        NULL,
        WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        hwnd,
        NULL,
        ghThisInstance,
        NULL
        );

    SetWindowPos(hwndTT,
        HWND_TOPMOST,
        0,
        0,
        0,
        0,
        SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);

    /* GET COORDINATES OF THE MAIN CLIENT AREA */
    GetClientRect (hwnd, &rect);

    /* INITIALIZE MEMBERS OF THE TOOLINFO STRUCTURE */
    ti.cbSize = sizeof(TOOLINFO);
    ti.uFlags = TTF_SUBCLASS;
    ti.hwnd = hwnd;
    ti.hinst = ghThisInstance;
    ti.uId = uid;
    ti.lpszText = lptstr;
        // ToolTip control will cover the whole window
    ti.rect.left = rect.left;
    ti.rect.top = rect.top;
    ti.rect.right = rect.right;
    ti.rect.bottom = rect.bottom;

    /* SEND AN ADDTOOL MESSAGE TO THE TOOLTIP CONTROL WINDOW */
    SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);

}

The output window for this sample looks like this.

Tracking ToolTips

Tracking ToolTips change position on the screen dynamically. They are supported by version 4.70 and later of the common controls. To create a tracking ToolTip, use the TTM_ADDTOOL message, including the TTF_TRACK flag in the uFlags member of the accompanying TOOLINFO structure.

Your application must manually activate and deactivate a tracking ToolTip by sending a TTM_TRACKACTIVATE message. Activation or deactivation also shows or hides the ToolTip, respectively. While a tracking ToolTip is active, your application must specify the location of the ToolTip by sending TTM_TRACKPOSITION messages to the ToolTip control. Because the application handles tasks such as positioning the ToolTip, tracking ToolTips do not use the TTF_SUBCLASS flag or the TTM_RELAYEVENT message.

The TTM_TRACKPOSITION message causes the ToolTip control to display the window using one of two placement styles:

  • By default, the ToolTip is displayed next to the corresponding tool in a position the control chooses. The location chosen is relative to the coordinates you provide using this message. In this case, the ToolTip window appears to move beside the corresponding tool.
  • If you include the TTF_ABSOLUTE value in the uFlags member of the TOOLINFO structure, the ToolTip will be displayed at the pixel location specified in the message. In this case, the control does not attempt to change the ToolTip window's location from the coordinates you provide.

Example

The following example demonstrates how to create a ToolTip control and assign a tool to it. The example specifies the main window's entire client area as the tool, but you could specify distinct portions of the client area or specify a different window altogether.

The example uses the TTM_ADDTOOL message to add the tool to the ToolTip control. The uFlags member of the TOOLINFO structure used in the example includes the TTF_ABSOLUTE flag. This flag causes the ToolTip control to display ToolTip text at the exact coordinates the application provides when it sends the TTM_TRACKPOSITION message. Without the TTF_ABSOLUTE flag, the ToolTip control chooses a location to display the ToolTip text based on the coordinates you provide. This causes ToolTip text to appear next to the corresponding tool, but not necessarily at the exact coordinates the application provided.

For additional information about using the TTM_TRACKPOSITION message, see Supporting Tracking ToolTips.

HWND WINAPI CreateTT(HWND hwndOwner)
{
    INITCOMMONCONTROLSEX icex;
    HWND        hwndTT;
    TOOLINFO    ti;
    // Load the ToolTip class from the DLL.
    icex.dwSize = sizeof(icex);
    icex.dwICC  = ICC_BAR_CLASSES;

    if(!InitCommonControlsEx(&icex))
       return NULL;

    // Create the ToolTip control.
    hwndTT = CreateWindow(TOOLTIPS_CLASS, TEXT(""),
                          WS_POPUP,
                          CW_USEDEFAULT, CW_USEDEFAULT,
                          CW_USEDEFAULT, CW_USEDEFAULT,
                          NULL, (HMENU)NULL, g_hinst,
                          NULL);

    // Prepare TOOLINFO structure for use as tracking ToolTip.
    ti.cbSize = sizeof(TOOLINFO);
    ti.uFlags = TTF_IDISHWND | TTF_TRACK | TTF_ABSOLUTE;
    ti.hwnd   = hwndOwner;
    ti.uId    = (UINT)g_hwndMain;
    ti.hinst  = g_hinst;
    ti.lpszText  = LPSTR_TEXTCALLBACK;
    ti.rect.left = ti.rect.top = ti.rect.bottom = ti.rect.right = 0;

    // Add the tool to the control, displaying an error if needed.
    if(!SendMessage(hwndTT,TTM_ADDTOOL,0,(LPARAM)&ti)){
        MessageBox(hwndOwner,"Couldn't create the ToolTip control.",
                   "Error",MB_OK);
        return NULL;
    }

    // Activate (display) the tracking ToolTip. Then, set a global
    // flag value to indicate that the ToolTip is active, so other
    // functions can check to see if it's visible.
    SendMessage(hwndTT,TTM_TRACKACTIVATE,(WPARAM)TRUE,(LPARAM)&ti);
    g_bIsVisible = TRUE;

    return(hwndTT);
}

Supporting Tracking ToolTips

The following example is a simple window process function that supports tracking ToolTips. It requests the current position of the mouse pointer by using the GetCursorPos function and then adds 15 pixels to the x- and y-coordinates, so the ToolTip appears slightly below and to the right of the pointer. GetCursorPos returns the screen coordinates of the cursor in a POINT structure.

Note that the example relies on the value of a global variable, g_bIsVisible, to determine whether the application should send the TTM_TRACKPOSITION message. For the purpose of this example, g_bIsVisible is a Boolean variable that another function sets to TRUE upon sending the TTM_TRACKACTIVATE message to activate the ToolTip. This way, if the ToolTip is inactive, the additional overhead to calculate and send a message is not incurred.

LRESULT CALLBACK WndProc (HWND hwnd, UINT msg,
                               WPARAM wParam, LPARAM lParam)
{
  switch(msg){
    case WM_MOUSEMOVE:
      if(g_bIsVisible){

#define X_OFFSET 15
#define Y_OFFSET X_OFFSET

        SendMessage(g_hwndTT,
                    TTM_TRACKPOSITION,
                    0,
                    (LPARAM)MAKELPARAM(GET_X_LPARAM(lParam) + X_OFFSET,
                                       GET_Y_LPARAM(lParam) + Y_OFFSET));
      }
      break;

/*
 *
 *  Other standard window messages can be handled here.
 *
 */
  }
  return 0;
}

Multiline ToolTips

Multiline ToolTips allow text to be displayed on more than one line. They are supported by version 4.70 and later of the common controls. Your application creates a multiline ToolTip by responding to a TTN_GETDISPINFO notification message. To force the ToolTip control to use multiple lines, send a TTM_SETMAXTIPWIDTH message, specifying the width of the display rectangle. Text that exceeds this width will wrap to the next line rather than widening the display region. The rectangle height will be increased as needed to accommodate the additional lines. The ToolTip control will wrap the lines automatically, or you can use a carriage return/line feed combination, \r\n, to force line breaks at particular locations.

Note that the text buffer specified by the szText member of the NMTTDISPINFO structure can accommodate only 80 characters. If you need to use a longer string, point the lpszText member of NMTTDISPINFO to a buffer containing the desired text.

The following code fragment is an example of a simple TTN_GETDISPINFO notification handler. It creates a multiline ToolTip by setting the display rectangle to 300 pixels and setting the lpszText member of NMTTDISPINFO to point to a buffer with the desired text.

char szLongMessage[ ] =
"This is a long message for the ToolTip, which will automatically "
"be wrapped when it exceeds the maximum tip width.  "
"Alternatively, you can use a \r\n"
"carriage return/line feed combination\r\n"
"to force line breaks at specific\r\n"
"locations.";

switch (lpnmhdr->code) {
  case TTN_GETDISPINFO:
    lpttd = (LPNMTTDISPINFO)lpnmhdr;
    SendMessage(lpnmhdr->hwndFrom, TTM_SETMAXTIPWIDTH, 0, 300);
    lpttd->lpszText = szLongMessage;
    return 0;

    ...
 //Other notification handlers go here, as needed.
}

Balloon ToolTips

Balloon ToolTips are similar to standard ToolTips, but are displayed in a cartoon-style "balloon" with a stem pointing to the tool. Balloon ToolTips can be either single-line or multiline. They are created and handled in much the same way as standard ToolTips.

The default position of the stem and rectangle is shown below. If the tool is too close to the top of the screen, the ToolTip appears below and to the right of the tool's rectangle. If the tool is too close to the right side of the screen, similar principles apply, but the ToolTip appears to the left of the tool's rectangle.

You can change the default positioning by setting the TTF_CENTERTIP flag in the uFlags member of the ToolTip's TOOLINFO structure. In that case, the stem normally will point to the center of the lower edge of the tool's rectangle, and the text rectangle will be displayed directly below the tool. The stem will attach to the text rectangle at the center of the upper edge. If the tool is too close to the bottom of the screen, the text rectangle will be centered above the tool, and the stem will attach to the center of the lower edge.

If you want to specify where the stem points, set the TTF_TRACK flag in the uFlags member of the ToolTip's TOOLINFO structure. You then specify the coordinate by sending a TTM_TRACKPOSITION message, with the x- and y-coordinates in the lParam value. If TTF_CENTERTIP is also set, the stem still points to the position specified by the TTM_TRACKPOSITION message.

The following code fragment illustrates how to implement a centered balloon ToolTip.

hwndToolTips = CreateWindow(TOOLTIPS_CLASS,
                            NULL,
                            WS_POPUP | TTS_NOPREFIX | TTS_BALLOON,
                            0, 0,
                            0, 0,
                            NULL, NULL,
                            g_hinst,
                            NULL);
if (hwndTooltip)
{
// Do the standard ToolTip coding.
    TOOLINFO ti;

    ti.cbSize = sizeof(ti);
    ti.uFlags = TTF_TRANSPARENT | TTF_CENTERTIP;
    ti.hwnd = hwnd;
    ti.uId = 0;
    ti.hinst = NULL;
    ti.lpszText = LPSTR_TEXTCALLBACK;

    GetClientRect(hwnd, &ti.rect);
    SendMessage(hwndToolTips, TTM_ADDTOOL, 0, (LPARAM) &ti );
}

Balloon ToolTips for Status Bar Icons

A nonintrusive way to display an explanatory message for a status bar icon is to implement a balloon ToolTip with its stem pointing to the icon. The ToolTip will disappear when clicked, but you can also specify a time-out value. The ToolTip will look similar to the following illustration.

For a detailed discussion of the status bar, see the The Taskbar documentation.

The following code fragment illustrates how to add a balloon ToolTip to a status bar icon.

To display a balloon ToolTip, you need to set the NIF_INFO flag in the NOTIFYICONDATA structure, and use the szInfo and uTimeout members to specify the ToolTip text and time-out duration.

Show Example

#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))

NOTIFYICONDATA IconData = {0};

IconData.cbSize = SIZEOF(IconData);
IconData.hWnd = hwndNI;
IconData.uFlags = NIF_INFO;

HRESULT hr = StringCchCopy(IconData.szInfo, ARRAYSIZE(IconData.szInfo), TEXT("Your message text goes here."));
if(FAILED(hr))
{
// TODO: Write an error handler in case the call to StringCchCopy fails.
}
IconData.uTimeout = 15000; // in milliseconds

Shell_NotifyIcon(NIM_MODIFY, &IconData);

In-Place ToolTips

In-place ToolTips are used to display text strings for objects that have been clipped, such as the folder names shown below in Microsoft® Windows® Explorer. In this illustration, information concerning the scribble folder is shown in the tooltip.

The difference between ordinary and in-place ToolTips is positioning. By default, when the mouse pointer hovers over a region that has a ToolTip associated with it, the ToolTip is displayed adjacent to the region. However, ToolTips are windows, and they can be positioned anywhere you choose by calling SetWindowPos . Creating an in-place ToolTip is a matter of positioning the ToolTip window so that it overlays the text string.

Positioning an In-Place ToolTip

You need to keep track of three rectangles when positioning an in-place ToolTip:

  • The rectangle that surrounds the complete label text.
  • The rectangle that surrounds the ToolTip text. The ToolTip text is identical to the complete label text, and normally is the same size and font. The two text rectangles will thus usually be the same size.
  • The ToolTip's window rectangle. This rectangle is somewhat larger than the ToolTip text rectangle that it encloses.

The three rectangles are shown schematically in the following illustration. The hidden portion of the label text is indicated by a gray background.

To create an in-place ToolTip, you must position the ToolTip text rectangle so that it overlays the label text rectangle. The procedure for aligning the two rectangles is relatively straightforward:

  1. Define the label text rectangle.
  2. Position the ToolTip window so that the ToolTip text rectangle overlays the label text rectangle

In practice, it is usually sufficient to align the upper-left corner of the two text rectangles. Attempting to resize the ToolTip text rectangle to exactly match the label text rectangle could cause problems with the ToolTip display.

The problem with this simple scheme is that you can't position the ToolTip text rectangle directly. Instead, you must position the ToolTip window rectangle just far enough above and to the left of the label text rectangle so that the corners of the two text rectangles coincide. In other words, you need to know the offset between the ToolTip window rectangle and its enclosed text rectangle. In general, there is no simple way to determine this offset.

Using TTM_ADJUSTRECT to Position a ToolTip

Common controls version 5.80 simplifies the use of in-place ToolTips by the addition of a new message, TTM_ADJUSTRECT . Send this message with the coordinates of the label text rectangle that you want the ToolTip to overlay, and it will return the coordinates of an appropriately positioned ToolTip window rectangle.

The following code fragment illustrates how to use TTM_ADJUSTRECT in a TTN_SHOW handler to display an in-place ToolTip. Your application indicates that the label text is truncated by setting the private fMyStringIsTruncated variable to TRUE. The handler calls an application-defined function, GetMyItemRect, to retrieve the label text rectangle. This rectangle is passed to the ToolTip control with TTM_ADJUSTRECT, which returns the corresponding window rectangle. SetWindowPos is then called to position the ToolTip over the label.

case TTN_SHOW:

if (fMyStringIsTruncated) {
    RECT rc;

    GetMyItemRect(&rc);
    SendMessage(hwndToolTip, TTM_ADJUSTRECT, TRUE, (LPARAM)&rc);
    SetWindowPos(hwndToolTip,
                 NULL,
                 rc.left, rc.top,
                 0, 0,
                 SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
}

This example does not change the size of the ToolTip, just its position. The two text rectangles will be aligned at their upper-left corners, but not necessarily with the same dimensions. In practice, the difference is usually small, and this approach is recommended for most purposes. While you can, in principle, use SetWindowPos to resize as well as reposition the ToolTip, doing so might have unpredictable consequences.


Trackbar Controls

A trackbar is a window that contains a slider and optional tick marks. When the user moves the slider, using either the mouse or the direction keys, the trackbar sends notification messages to indicate the change.

  • About Trackbar Controls
  • Using Trackbar Controls
  • Trackbar Control Updates in Internet Explorer

About Trackbar Controls

Trackbars are useful when you want the user to select a discrete value or a set of consecutive values in a range. For example, you might use a trackbar to allow the user to set the repeat rate of the keyboard by moving the slider to a given tick mark. The following illustration shows a typical trackbar.

The slider in a trackbar moves in increments that you specify when you create it. The values in this range are referred to as logical units. For example, if you specify that the trackbar should have logical units that range from zero to five, the slider can occupy only six positions: a position at the left side of the trackbar and one position for each increment in the range. Typically, each of these positions is identified by a tick mark.

You create a trackbar by using the CreateWindowEx function, specifying the TRACKBAR_CLASS window class. After you have created a trackbar, you can use trackbar messages to set and retrieve many of its properties. Changes that you can make include setting the minimum and maximum positions for the slider, drawing tick marks, setting a selection range, and repositioning the slider.

Trackbar Messages

The logical units of a trackbar are the set of contiguous values that the trackbar can represent. They are usually defined by specifying the range of possible values with a TBM_SETRANGE message when the trackbar is first created. Applications can dynamically alter the range by using the TBM_SETRANGEMAX and TBM_SETRANGEMIN messages. An application that allows the range to be changed dynamically retrieves the final range settings when the user has finished working with the trackbar. To retrieve these settings, use the TBM_GETRANGEMAX and TBM_GETRANGEMIN messages.

An application can send messages to the trackbar to retrieve information about the window and to change its characteristics. To retrieve the position of the slider (that is, the value the user has chosen), use the TBM_GETPOS message. To set the position of the slider, use the TBM_SETPOS message.

A trackbar automatically displays tick marks at its beginning and end, unless you specify the TBS_NOTICKS style. You can use the TBS_AUTOTICKS style to automatically display additional tick marks at regular intervals along the trackbar. By default, a TBS_AUTOTICKS trackbar displays a tick mark at each increment of the trackbar's range. To specify a different interval for the automatic tick marks, send the TBM_SETTICFREQ message to the trackbar. For example, you could use this message to display only 10 tick marks in a range of 1 through 100.

To set the position of a single tick mark, send the TBM_SETTIC message. A trackbar maintains an array of DWORD values that stores the position of each tick mark. The array does not include the first and last tick marks that the trackbar creates automatically. You can specify an index in this array when you send the TBM_GETTIC message to retrieve the position of the corresponding tick mark. Alternatively, you can send the TBM_GETPTICS message to retrieve a pointer to the array. The number of elements in the array is equal to two less than the tick count returned by the TBM_GETNUMTICS message. This is because the count returned by TBM_GETNUMTICS includes the first and last tick marks that are not included in the array. To retrieve the physical position of a tick mark, in client coordinates of the trackbar's window, send the TBM_GETTICPOS message. The TBM_CLEARTICS message removes all but the first and last of a trackbar's tick marks.

A trackbar's line size determines how far the slider moves in response to keyboard input from the arrow keys, such as the RIGHT ARROW or DOWN ARROW key. To retrieve or set the line size, send the TBM_GETLINESIZE and TBM_SETLINESIZE messages. The trackbar also sends the TB_LINEUP and TB_LINEDOWN notification messages to its parent window when the user presses the arrow keys.

A trackbar's page size determines how far the slider moves in response to keyboard input, such as the PAGE UP or PAGE DOWN key, or mouse input, such as clicks in the trackbar channel. To retrieve or set the page size, send the TBM_GETPAGESIZE and TBM_SETPAGESIZE messages. The trackbar also sends the TB_PAGEUP and TB_PAGEDOWN notification messages to its parent window when it receives keyboard or mouse input that scrolls the page. For more information, see Trackbar Notification Messages.

An application can send messages to retrieve the dimensions of a trackbar. The TBM_GETTHUMBRECT message retrieves the bounding rectangle for the slider. The TBM_GETTHUMBLENGTH message retrieves the length of the slider. The TBM_GETCHANNELRECT message retrieves the bounding rectangle for the trackbar's channel, which is the area over which the slider moves. It contains the highlight when a range is selected. If a trackbar has the TBS_FIXEDLENGTH style, you can send the TBM_SETTHUMBLENGTH message to change the length of the slider.

If you create a trackbar with the TBS_ENABLESELRANGE style, you can specify a "selection range," which restricts the user to a specified portion of the total range. The logical units do not change, but only a subset of them are available for use. The trackbar highlights the available range and displays triangular tick marks at the start and end. Typically, an application handles the trackbar's notification messages and sets the trackbar's selection range according to the user's input.

You retrieve or set the selection range by sending messages to the trackbar. Use the TBM_SETSEL message to set the starting and ending positions of a selection. To set just the starting position or just the ending position of a selection, send a TBM_SETSELSTART or TBM_SETSELEND message. To retrieve the starting or ending positions of a selection range, send a TBM_GETSELSTART or TBM_GETSELEND message. To clear a selection range and restore the trackbar to its original range, send the TBM_CLEARSEL message.

Trackbar Notification Messages

A trackbar notifies its parent window of user actions by sending the parent a WM_HSCROLL or WM_VSCROLL message. A trackbar with the TBS_HORZ style sends WM_HSCROLL messages. A trackbar with the TBS_VERT style sends WM_VSCROLL messages. The low-order word of the wParam parameter of WM_HSCROLL or WM_VSCROLL contains the notification code. For the TB_THUMBPOSITION and TB_THUMBTRACK notifications, the high-order word of the wParam parameter specifies the position of the slider. For all other notifications, the high-order word is zero; send the TBM_GETPOS message to determine the slider position. The lParam parameter is the handle to the trackbar.

The system sends the TB_BOTTOM, TB_LINEDOWN, TB_LINEUP, and TB_TOP notification messages only when the user interacts with a trackbar by using the keyboard. The TB_THUMBPOSITION and TB_THUMBTRACK notification messages are only sent when the user is using the mouse. The TB_ENDTRACK, TB_PAGEDOWN, and TB_PAGEUP notification messages are sent in both cases. The following table lists the trackbar notification messages and the events (virtual key codes or mouse events) that cause the notifications to be sent.

Notification message | Reason sent
TB_BOTTOM | VK_END
TB_ENDTRACK | WM_KEYUP (the user released a key that sent a relevant virtual key code)
TB_LINEDOWN | VK_RIGHT or VK_DOWN
TB_LINEUP | VK_LEFT or VK_UP
TB_PAGEDOWN | VK_NEXT (the user clicked the channel below or to the right of the slider)
TB_PAGEUP | VK_PRIOR (the user clicked the channel above or to the left of the slider)
TB_THUMBPOSITION | WM_LBUTTONUP following a TB_THUMBTRACK notification message
TB_THUMBTRACK | Slider movement (the user dragged the slider)
TB_TOP | VK_HOME

Default Trackbar Message Processing

This section describes the window message processing performed by a trackbar.

Message | Processing performed
WM_CAPTURECHANGED | Kills the timer if one was set during WM_LBUTTONDOWN processing and sends the TB_THUMBPOSITION notification message, if necessary. It always sends the TB_ENDTRACK notification message.
WM_CREATE | Performs additional initialization, such as setting the line size, page size, and tick mark frequency to default values.
WM_DESTROY | Frees resources.
WM_ENABLE | Repaints the trackbar window.
WM_ERASEBKGND | Erases the window background, using the current background color for the trackbar.
WM_GETDLGCODE | Returns the DLGC_WANTARROWS value.
WM_KEYDOWN | Processes the direction keys and sends the TB_TOP, TB_BOTTOM, TB_PAGEUP, TB_PAGEDOWN, TB_LINEUP, and TB_LINEDOWN notification messages, as appropriate.
WM_KEYUP | Sends the TB_ENDTRACK notification message if the key was one of the direction keys.
WM_KILLFOCUS | Repaints the trackbar window.
WM_LBUTTONDOWN | Sets the focus and the mouse capture to the trackbar. When necessary, it sets a timer that determines how quickly the slider moves toward the mouse cursor when the user holds down the mouse button in the window.
WM_LBUTTONUP | Releases the mouse capture and kills the timer if one was set during WM_LBUTTONDOWN processing. It sends the TB_THUMBPOSITION notification message, if necessary. It always sends the TB_ENDTRACK notification message.
WM_MOUSEMOVE | Moves the slider and sends the TB_THUMBTRACK notification message when tracking the mouse (see WM_TIMER ).
WM_PAINT | Paints the trackbar. If the wParam parameter is non-NULL, the control assumes that the value is an HDC and paints using that device context.
WM_SETFOCUS | Repaints the trackbar window.
WM_SIZE | Sets the dimensions of the trackbar, removing the slider if there is not enough room to display it.
WM_TIMER | Retrieves the mouse position and updates the position of the slider. (It is received only when the user is dragging the slider.)
WM_WININICHANGE | Initializes slider dimensions.

Creating a Trackbar

The following example shows how to create a trackbar with the TBS_AUTOTICKS and TBS_ENABLESELRANGE styles. When the trackbar is created, both its range and its selection range are initialized. The page size is also set at this time.

// CreateTrackbar - creates and initializes a trackbar.
//
// Global variable
//     g_hinst - instance handle
HWND WINAPI CreateTrackbar(
    HWND hwndDlg,  // handle of dialog box (parent window)
    UINT iMin,     // minimum value in trackbar range
    UINT iMax,     // maximum value in trackbar range
    UINT iSelMin,  // minimum value in trackbar selection
    UINT iSelMax)  // maximum value in trackbar selection
{

    InitCommonControls(); // loads common control's DLL

    hwndTrack = CreateWindowEx(
        0,                             // no extended styles
        TRACKBAR_CLASS,                // class name
        "Trackbar Control",            // title (caption)
        WS_CHILD | WS_VISIBLE |
        TBS_AUTOTICKS | TBS_ENABLESELRANGE,  // style
        10, 10,                        // position
        200, 30,                       // size
        hwndDlg,                       // parent window
        ID_TRACKBAR,             // control identifier
        g_hinst,                       // instance
        NULL                           // no WM_CREATE parameter
        );

    SendMessage(hwndTrack, TBM_SETRANGE,
        (WPARAM) TRUE,                   // redraw flag
        (LPARAM) MAKELONG(iMin, iMax));  // min. & max. positions
    SendMessage(hwndTrack, TBM_SETPAGESIZE,
        0, (LPARAM) 4);                  // new page size

    SendMessage(hwndTrack, TBM_SETSEL,
        (WPARAM) FALSE,                  // redraw flag
        (LPARAM) MAKELONG(iSelMin, iSelMax);
    SendMessage(hwndTrack, TBM_SETPOS,
        (WPARAM) TRUE,                   // redraw flag
        (LPARAM) iSelMin);

    SetFocus(hwndTrack);

    return hwndTrack;
}

Processing Trackbar Notification Messages

The following example is a function that is called whenever a WM_HSCROLL message is received by the dialog box containing the trackbar. The trackbar has the TBS_ENABLESELRANGE style. The position of the slider is compared against the selection range, and the slider is moved to the starting or ending position of the selection range, when necessary.

A dialog containing a trackbar with the TBS_VERT style could use this function when it receives a WM_VSCROLL message.

// TBNotifications - handles trackbar notifications received
// in the wParam parameter of WM_HSCROLL. This function simply
// ensures that the slider remains within the selection range.

VOID WINAPI TBNotifications(
    WPARAM wParam,  // wParam of WM_HSCROLL message
    HWND hwndTrack, // handle of trackbar window
    UINT iSelMin,   // minimum value of trackbar selection
    UINT iSelMax)   // maximum value of trackbar selection
    {
    DWORD dwPos;    // current position of slider

    switch (LOWORD(wParam)) {
        case TB_ENDTRACK:
            dwPos = SendMessage(hwndTrack, TBM_GETPOS, 0, 0);
            if (dwPos > iSelMax)
                SendMessage(hwndTrack, TBM_SETPOS,
                    (WPARAM) TRUE,       // redraw flag
                    (LPARAM) iSelMax);
            else if (dwPos < iSelMin)
                SendMessage(hwndTrack, TBM_SETPOS,
                    (WPARAM) TRUE,       // redraw flag
                    (LPARAM) iSelMin);
            break;

        default:
            break;

        }
}

Trackbar Control Updates in Internet Explorer

Trackbar controls in Microsoft® Internet Explorer support the following new features.

Buddy Windows | Trackbar controls now provide support for up to two buddy windows. Trackbar buddy windows are automatically positioned by the control to appear centered at the ends of the trackbar control. To assign an existing window to a trackbar, use the TBM_SETBUDDY message. To retrieve the handle to a given buddy window, send the TBM_GETBUDDY message.
ToolTips | Trackbar controls now support ToolTips. A trackbar creates a default ToolTip control when created with the TBS_TOOLTIPS style. However, you can assign a new ToolTip control to a trackbar by sending the TBM_SETTOOLTIPS message. To retrieve the handle to an assigned ToolTip control, use the TBM_GETTOOLTIPS message.


Tree

Tree-View Controls

A tree-view control is a window that displays a hierarchical list of items, such as the headings in a document, the entries in an index, or the files and directories on a disk. Each item consists of a label and an optional bitmapped image, and each item can have a list of subitems associated with it. By clicking an item, the user can expand or collapse the associated list of subitems.

The following topics are discussed.

  • About Tree-View Controls
  • Using Tree-View Controls
  • Tree-View Control Updates in Internet Explorer
  • Related Topics

About Tree-View Controls

You create a tree-view control by using the CreateWindowEx function, specifying the WC_TREEVIEW window class. The class is registered when the common control dynamic-link library (DLL) is loaded. To ensure that this DLL is loaded, include the InitCommonControls function in your application.

After creating a tree-view control, you add, remove, arrange, or otherwise manipulate items by sending messages to the control. Each message has one or more corresponding macros that you can use instead of sending the message explicitly.

Tree-View Styles

Tree-view styles govern aspects of a tree-view control's appearance. You set the initial styles when you create the tree-view control. You can retrieve and change the styles after creating the tree-view control by using the GetWindowLong and SetWindowLong functions.

The TVS_HASLINES style enhances the graphic representation of a tree-view control's hierarchy by drawing lines that link child items to their parent item. This style does not link items at the root of the hierarchy. To do so, you need to combine the TVS_HASLINES and TVS_LINESATROOT styles.

The user can expand or collapse a parent item's list of child items by double-clicking the parent item. A tree-view control that has the TVS_HASBUTTONS style adds a button to the left side of each parent item. The user can click the button once instead of double-clicking the parent item to expand or collapse the child. TVS_HASBUTTONS does not add buttons to items at the root of the hierarchy. To do so, you must combine TVS_HASLINES, TVS_LINESATROOT, and TVS_HASBUTTONS.

The TVS_EDITLABELS style makes it possible for the user to edit the labels of tree-view items. For more information about editing labels, see Tree-View Label Editing.

The TVS_SHOWSELALWAYS style causes a selected item to remain selected when the tree-view control loses focus.

The TVS_CHECKBOXES style creates checkboxes next to each item. If you want to use the checkbox style, you must set the TVS_CHECKBOXES style (with SetWindowLong) after you create the tree-view control and before you populate the tree. Otherwise, the checkboxes might appear unchecked, depending on timing issues.

Parent and Child Items

Any item in a tree-view control can have a list of subitems—called child items—associated with it. An item that has one or more child items is called a parent item. A child item is displayed below its parent item and is indented to indicate that it is subordinate to the parent. An item that has no parent appears at the top of the hierarchy and is called a root item.

To add an item to a tree-view control, send the TVM_INSERTITEM message to the control. The message returns a handle to the HTREEITEM type, which uniquely identifies the item. When adding an item, you must specify the handle to the new item's parent item. If you specify NULL or the TVI_ROOT value instead of a parent item handle in the TVINSERTSTRUCT structure, the item is added as a root item.

At any given time, the state of a parent item's list of child items can be either expanded or collapsed. When the state is expanded, the child items are displayed below the parent item. When it is collapsed, the child items are not displayed. The list automatically toggles between the expanded and collapsed states when the user double-clicks the parent item or, if the parent has the TVS_HASBUTTONS style, when the user clicks the button associated with the parent item. An application can expand or collapse the child items by using the TVM_EXPAND message.

A tree-view control sends the parent window a TVN_ITEMEXPANDING notification message when a parent item's list of child items is about to be expanded or collapsed. The notification gives an application the opportunity to prevent the change or to set any attributes of the parent item that depend on the state of the list of child items. After changing the state of the list, the tree-view control sends the parent window a TVN_ITEMEXPANDED notification message.

When a list of child items is expanded, it is indented relative to the parent item. You can set the amount of indentation by using the TVM_SETINDENT message or retrieve the current amount by using the TVM_GETINDENT message.

A tree-view control uses memory allocated from the heap of the process that creates the tree-view control. The maximum number of items in a tree view is based on the amount of memory available in the heap.

Item Labels

You typically specify the text of an item's label when adding the item to the tree-view control. The TVM_INSERTITEM message includes a TVITEM structure that defines the item's properties, including a string containing the text of the label.

A tree-view control allocates memory for storing each item; the text of the item labels takes up a significant portion of this memory. If your application maintains a copy of the strings in the tree-view control, you can decrease the memory requirements of the control by specifying the LPSTR_TEXTCALLBACK value in the pszText member of TVITEM instead of passing actual strings to the tree view. Using LPSTR_TEXTCALLBACK causes the tree-view control to retrieve the text of an item's label from the parent window whenever the item needs to be redrawn. To retrieve the text, the tree-view control sends a TVN_GETDISPINFO notification message, which includes the address of an NMTVDISPINFO structure. The parent window must fill the appropriate members of the included structure.

Tree-View Label Editing

The user can directly edit the labels of items in a tree-view control that has the TVS_EDITLABELS style. The user begins editing by clicking the label of the item that has the focus. An application begins editing by using the TVM_EDITLABEL message. The tree-view control notifies the parent window when editing begins and when it is canceled or completed. When editing is completed, the parent window is responsible for updating the item's label, if appropriate.

When label editing begins, a tree-view control sends its parent window a TVN_BEGINLABELEDIT notification message. By processing this notification, an application can allow editing of some labels and prevent editing of others. Returning zero allows editing, and returning nonzero prevents it.

When label editing is canceled or completed, a tree-view control sends its parent window a TVN_ENDLABELEDIT notification message. The lParam parameter is the address of an NMTVDISPINFO structure. The item parameter is a TVITEM structure that identifies the item and includes the edited text. The parent window is responsible for updating the item's label if it wishes to keep the new label. The pszText member of TVITEM is zero if editing is canceled.

During label editing, typically in response to the TVN_BEGINLABELEDIT notification message, you can retrieve the handle to the edit control used for label editing by using the TVM_GETEDITCONTROL message. You can send the edit control an EM_SETLIMITTEXT message to limit the amount of text a user can enter or subclass the edit control to intercept and discard invalid characters. Note, however, that the edit control is displayed only after TVN_BEGINLABELEDIT is sent.

Tree-View Item Position

An item's initial position is set when the item is added to the tree-view control by using the TVM_INSERTITEM message. The message includes a TVINSERTSTRUCT structure that specifies the handle to the parent item and the handle to the item after which the new item is to be inserted. The second handle must identify either a child item of the given parent or one of these values: TVI_FIRST, TVI_LAST, or TVI_SORT.

When TVI_FIRST or TVI_LAST is specified, the tree-view control places the new item at the beginning or end of the given parent item's list of child items. When TVI_SORT is specified, the tree-view control inserts the new item into the list of child items in alphabetical order based on the text of the item labels.

You can put a parent item's list of child items in alphabetical order by using the TVM_SORTCHILDREN message. The message includes a parameter that specifies whether all levels of child items descending from the given parent item are also sorted in alphabetical order.

The TVM_SORTCHILDRENCB message allows you to sort child items based on criteria that you define. When you use this message, you specify an application-defined callback function that the tree-view control can call whenever the relative order of two child items needs to be decided. The callback function receives two 32-bit application-defined values for the items being compared and a third 32-bit value that you specify when sending TVM_SORTCHILDRENCB.

Tree-View Item States Overview

Each item in a tree-view control has a current state. The state information for each item includes a set of bit flags as well as image list indexes that indicate the item's state image and overlay image. The bit flags indicate whether the item is selected, disabled, expanded, and so on. For the most part, a tree-view control automatically sets an item's state to reflect user actions, such as selection of an item. However, you can also set an item's state by using the TVM_SETITEM message, and you can retrieve the current state of an item by using the TVM_GETITEM message. For a complete list of item states, see Tree-View Control Item States .

An item's current state is specified by the state member of the TVITEM structure. A tree-view control might change an item's state to reflect a user action, such as selecting the item or setting the focus to the item. In addition, an application might change an item's state to disable or hide the item or to specify an overlay image or state image.

When you specify or change an item's state, the statemask member of TVITEM specifies which state bits to set, and the state member contains the new values for those bits.

To set an item's overlay image, statemask must include the TVIS_OVERLAYMASK value, and state must include the one-based index of the overlay image shifted left 8 bits by using the INDEXTOOVERLAYMASK macro. The index can be zero to specify no overlay image.

A state image is displayed next to an item's icon to indicate an application-defined state. State images are contained in a state image list that is specified by sending a TVM_SETIMAGELIST message. To set an item's state image, include the TVIS_STATEIMAGEMASK value in the statemask member of the TVITEM structure. Bits 12 through 15 of the structure's state member specify the index in the state image list of the image to be drawn.

To set the state image index, use INDEXTOSTATEIMAGEMASK . This macro takes an index, and sets bits 12 through 15 appropriately. To indicate that the item has no state image, set the index to zero. This convention means that image zero in the state image list cannot be used as a state image. To isolate bits 12 through 15 of the state member, use the TVIS_STATEIMAGEMASK mask. For more information about overlay and state images, see Tree-View Image Lists.

Item Selection

A tree-view control notifies the parent window when the selection changes from one item to another by sending the TVN_SELCHANGING and TVN_SELCHANGED notification messages. Both notifications include a value that specifies whether the change is the result of a mouse click or a keystroke. The notifications also include information about the item that is gaining the selection and the item that is losing the selection. You can use this information to set item attributes that depend on the selection state of the item. Returning TRUE in response to TVN_SELCHANGING prevents the selection from changing, and returning FALSE allows the change.

An application can change the selection by sending the TVM_SELECTITEM message.

Item Information

Tree-view controls support a number of messages that retrieve information about items in the control.

The TVM_GETITEM message can retrieve an item's handle and attributes. An item's attributes include its current state, the indexes in the control's image list of the item's selected and nonselected bitmapped images, a flag that indicates whether the item has child items, the address of the item's label string, and the item's application-defined 32-bit value.

The TVM_GETNEXTITEM message retrieves the tree-view item that bears the specified relationship to the current item. The message can retrieve an item's parent, the next or previous visible item, the first child item, and so on.

The TVM_GETITEMRECT message retrieves the bounding rectangle for a tree-view item. The TVM_GETCOUNT and TVM_GETVISIBLECOUNT messages retrieve a count of the items in a tree-view control and a count of the items that can be fully visible in the tree-view control's window, respectively. You can ensure that a particular item is visible by using the TVM_ENSUREVISIBLE message.

Tree-View Image Lists

Each item in a tree-view control can have four bitmapped images associated with it.

  • An image, such as an open folder, displayed when the item is selected.
  • An image, such as a closed folder, displayed when the item is not selected.
  • An overlay image that is drawn transparently over the selected or nonselected image.
  • A state image, which is an additional image displayed to the left of the selected or nonselected image. You can use state images, such as checked and cleared check boxes, to indicate application-defined item states.

By default, a tree-view control does not display item images. To display item images, you must create image lists and associate them with the control. For more information about image lists, see Image Lists .

A tree-view control can have two image lists: a normal image list and a state image list. A normal image list stores the selected, nonselected, and overlay images. A state image list stores state images. Use the ImageList_Create function to create an image list, and use other image list functions to add bitmaps to the image list. Then, to associate the image list with the tree-view control, use the TVM_SETIMAGELIST message. The TVM_GETIMAGELIST message retrieves a handle to one of a tree-view control's image lists. This message is useful if you need to add more images to the list.

In addition to the selected and nonselected images, a tree-view control's normal image list can contain up to four overlay images. Overlay images are identified by a one-based index and are designed to be drawn transparently over the selected and nonselected images. To assign an overlay mask index to an image in the normal image list, call the ImageList_SetOverlayImage function.

By default, all items display the first image in the normal image list for both the selected and nonselected states. Also, by default, items do not display overlay images or state images. You can change these default behaviors for an item by sending the TVM_INSERTITEM or TVM_SETITEM message. These messages use the TVITEM structure to specify image list indexes for an item.

To specify an item's selected and nonselected images, set the TVIF_SELECTEDIMAGE and TVIF_IMAGE bits in the mask member of the TVITEM structure and specify indexes from the control's normal image list in the iSelectImage and iImage members. Alternatively, you can specify the I_IMAGECALLBACK value in iSelectImage and iImage instead of specifying indexes. This causes the control to query its parent window for an image list index each time the item is about to be redrawn. The control sends the TVN_GETDISPINFO notification message to retrieve the index.

To associate an overlay image with an item, use the INDEXTOOVERLAYMASK macro to specify an overlay mask index in the state member of the item's TVITEM structure. You must also set the TVIS_OVERLAYMASK bits in the stateMask member. Overlay mask indexes are one-based; an index of zero indicates that no overlay image was specified.

State images are stored in a separate state image list and identified by their index. To specify the state image list, send a TVM_SETIMAGELIST message. Unlike the list-view control , which uses a one-based index to identify state images, tree-view control state images are identified by a zero-based index. However, an index of zero indicates that the item does not have a state image. Consequently, image zero cannot be used as a state image. For further discussion of item states and state images, see Tree-View Item States Overview.

Drag-and-Drop Operations

A tree-view control notifies the parent window when the user starts to drag an item. The parent window receives a TVN_BEGINDRAG notification message when the user begins dragging an item with the left mouse button and a TVN_BEGINRDRAG notification message when the user begins dragging with the right button. You can prevent a tree-view control from sending these notifications by giving the tree-view control the TVS_DISABLEDRAGDROP style.

You obtain an image to display during a drag operation by using the TVM_CREATEDRAGIMAGE message. The tree-view control creates a dragging bitmap based on the label of the item being dragged. Then the tree-view control creates an image list, adds the bitmap to it, and returns the handle to the image list.

You must provide the code that actually drags the item. This typically involves using the dragging capabilities of the image list functions and processing the WM_MOUSEMOVE and WM_LBUTTONUP (or WM_RBUTTONUP ) messages sent to the parent window after the drag operation has begun. For more information, see Dragging a Tree-View Item.

If items in a tree-view control are to be the targets of drag-and-drop operations, you need to know when the mouse pointer is on a target item. You can find out by using the TVM_HITTEST message. You specify the address of a TVHITTESTINFO structure that contains the current coordinates of the mouse pointer. When the SendMessage function returns, the structure contains a flag indicating the location of the mouse pointer relative to the tree-view control. If the pointer is over an item in the tree-view control, the structure contains the handle to the item as well.

You can indicate that an item is the target of a drag-and-drop operation by using the TVM_SETITEM message to set the state to the TVIS_DROPHILITED value. An item that has this state is drawn in the style used to indicate a drag-and-drop target.

About Tree-View Control Notification Messages

A tree-view control sends the following notification messages to its parent window in the form of WM_NOTIFY messages.

Notification | Description
TVN_BEGINDRAG | Signals the start of a drag-and-drop operation.
TVN_BEGINLABELEDIT | Signals the start of in-place label editing.
TVN_BEGINRDRAG | Signals that the right mouse button has started a drag-and-drop operation.
TVN_DELETEITEM | Signals the deletion of a specific item.
TVN_ENDLABELEDIT | Signals the end of label editing.
TVN_GETDISPINFO | Requests information that the tree-view control requires to display an item.
TVN_ITEMEXPANDED | Signals that a parent item's list of child items was expanded or collapsed.
TVN_ITEMEXPANDING | Signals that a parent item's list of child items is about to be expanded or collapsed.
TVN_KEYDOWN | Signals a keyboard event.
TVN_SELCHANGED | Signals that the selection has changed from one item to another.
TVN_SELCHANGING | Signals that the selection is about to be changed from one item to another.
TVN_SETDISPINFO | Notifies a parent window that it must update the information it maintains for an item.

Default Tree-View Control Message Processing

This section describes the window message processing performed by a tree-view control. Messages specific to tree-view controls are discussed in other sections of this document, so they are not included here.

Message | Processing performed
WM_COMMAND | Processes the EN_UPDATE and EN_KILLFOCUS edit control notification messages and forwards all other edit control notifications to the parent window. There is no return value.
WM_CREATE | Allocates memory and initializes internal data structures. It returns zero if successful, or -1 otherwise.
WM_DESTROY | Frees all system resources associated with the control. It returns zero.
WM_ENABLE | Enables or disables the control.
WM_ERASEBKGND | Erases the window background using the current background color for the tree-view control. It returns TRUE.
WM_GETDLGCODE | Returns a combination of the DLGC_WANTARROWS and DLGC_WANTCHARS values.
WM_GETFONT | Returns the handle to the current label font.
WM_HSCROLL | Scrolls the tree-view control. It returns TRUE if scrolling occurs, or FALSE otherwise.
WM_KEYDOWN | Sends the TVN_KEYDOWN notification message to the parent window for all keys. Sends the NM_RETURN (tree view) notification message when the user presses the ENTER key. It moves the caret when the user presses the direction keys or the PAGE UP, PAGE DOWN, HOME, END, or BACKSPACE key. It scrolls the tree-view control when the user presses the CTRL key in combination with those keys. It returns TRUE if a key is processed, or FALSE otherwise.
WM_KILLFOCUS | Repaints the focused item, if any, and sends an NM_KILLFOCUS (tree view) notification message to the parent window.
WM_LBUTTONDBLCLK | Cancels label editing and, if an item was double-clicked, sends the NM_DBLCLK notification message to the parent window. If the parent window returns 0, the tree-view control toggles the expanded state of the item, sending the parent window the TVN_ITEMEXPANDING and TVN_ITEMEXPANDED notification messages. There is no return value.
WM_LBUTTONDOWN | Toggles the expanded state if the user clicked the button associated with a parent item. If the user clicked an item label, the tree-view control selects and sets the focus to the item. If the user moves the mouse before releasing the mouse button, the tree-view control begins a drag-and-drop operation. There is no return value.
WM_PAINT | Paints the invalid region of the tree-view control. It returns zero. If the wParam parameter is non-NULL, the control assumes that the value is a handle to a device context (HDC) and paints using that device context.
WM_RBUTTONDOWN | Checks to see if an item was clicked and a drag operation was begun. If the operation has begun, it sends a TVN_BEGINRDRAG notification message to the parent window and highlights the drop target. Otherwise, it sends an NM_RCLICK notification message to the parent window. There is no return value.
WM_SETFOCUS | Repaints the focused item, if any, and sends an NM_SETFOCUS notification message to the parent window.
WM_SETFONT | Saves the specified font handle and repaints the tree-view control using the new font.
WM_SETREDRAW | Sets or clears the redraw flag. The tree-view control is redrawn after the redraw flag is set. It returns zero.
WM_SIZE | Recomputes internal variables that depend on the size of the tree-view control's client area. It returns TRUE.
WM_STYLECHANGED | Cancels label editing and redraws the tree-view control using the new styles. It returns zero.
WM_SYSCOLORCHANGE | Redraws the tree-view control using the new color if the redraw flag is set. There is no return value.
WM_TIMER | Begins editing an item label. If the user clicks the label of the focused item, the tree-view control sets a timer instead of entering edit mode immediately. The timer makes it possible for the tree view to avoid entering edit mode if the user double-clicks the label. It returns zero.
WM_VSCROLL | Scrolls the tree-view control. It returns TRUE if scrolling occurs, or FALSE otherwise.

Creating a Tree-View Control

To create a tree-view control, use the CreateWindowEx function, specifying the WC_TREEVIEW value for the window class. The tree-view window class is registered in the application's address space when the common control dynamic-link library (DLL) is loaded. To ensure that the DLL is loaded, use the InitCommonControls function.

Note When you create a tree-view control, you can also send it a WM_SETFONT message to set the font to be used for the text in the tree view. You should send this message prior to inserting any items. By default, a tree view uses the icon title font. Although you can customize the font on a per-item basis (by using Customizing a Control's Appearance Using Custom Draw , the tree-view control uses the dimensions of the font specified by the WM_SETFONT message to determine spacing and layout.

The following example creates a tree-view control that is sized to fit the client area of the parent window. It also uses application-defined functions to associate an image list with the control and add items to the control.

Show Example

// CreateATreeView - creates a tree-view control.
// Returns the handle to the new control if successful,
// or NULL otherwise.
// hwndParent - handle to the control's parent window.
// lpszFileName - name of the file to parse for tree-view items.

HWND CreateATreeView(HWND hwndParent, LPSTR lpszFileName)
{
    RECT rcClient;  // dimensions of client area
    HWND hwndTV;    // handle to tree-view control

    // Ensure that the common control DLL is loaded.
    InitCommonControls();

    // Get the dimensions of the parent window's client area, and create
    // the tree-view control.
    GetClientRect(hwndParent, &rcClient);
    hwndTV = CreateWindowEx(0,
                            WC_TREEVIEW,
                            "Tree View",
                            WS_VISIBLE | WS_CHILD | WS_BORDER | TVS_HASLINES,
                            0,
                            0,
                            rcClient.right,
                            rcClient.bottom,
                            hwndParent,
                            (HMENU)ID_TREEVIEW,
                            g_hinst,
                            NULL);

    // Initialize the image list, and add items to the control.
    // InitTreeViewImageLists and InitTreeViewItems are application-
    // defined functions.
    if (!InitTreeViewImageLists(hwndTV) ||
                !InitTreeViewItems(hwndTV, lpszFileName))
    {
        DestroyWindow(hwndTV);
        return FALSE;
    }
    return hwndTV;
}

Initializing the Image List

Every item in a tree-view control can have two images associated with it. An item displays one image when it is selected and the other when it is not. To include images with tree-view items, first use the Image Lists functions to create an image list and add images to it. Then associate the image list with the tree-view control by using the TVM_SETIMAGELIST message.

The following example creates an image list, adds three bitmaps to the list, and associates the image list with a tree-view control.

Show Example

// InitTreeViewImageLists - creates an image list, adds three bitmaps
// to it, and associates the image list with a tree-view control.
// Returns TRUE if successful, or FALSE otherwise.
// hwndTV - handle to the tree-view control.
//
// Global variables and constants
// g_nOpen, g_nClosed, and g_nDocument - integer variables for
// indexes of the images.
// CX_BITMAP and CY_BITMAP - width and height of an icon.
// NUM_BITMAPS - number of bitmaps to add to the image list.

BOOL InitTreeViewImageLists(HWND hwndTV)
{
    HIMAGELIST himl;  // handle to image list
    HBITMAP hbmp;     // handle to bitmap

    // Create the image list.
    if ((himl = ImageList_Create(CX_BITMAP,
                                 CY_BITMAP,
                                 FALSE,
                                 NUM_BITMAPS, 0)) == NULL)
        return FALSE;

    // Add the open file, closed file, and document bitmaps.
    hbmp = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDB_OPEN_FILE));
    g_nOpen = ImageList_Add(himl, hbmp, (HBITMAP)NULL);
    DeleteObject(hbmp);

    hbmp = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDB_CLOSED_FILE));
    g_nClosed = ImageList_Add(himl, hbmp, (HBITMAP)NULL);
    DeleteObject(hbmp);

    hbmp = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDB_DOCUMENT));
    g_nDocument = ImageList_Add(himl, hbmp, (HBITMAP)NULL);
    DeleteObject(hbmp);

    // Fail if not all of the images were added.
    if (ImageList_GetImageCount(himl) < 3)
        return FALSE;

    // Associate the image list with the tree-view control.
    TreeView_SetImageList(hwndTV, himl, TVSIL_NORMAL);

    return TRUE;
}

Adding Tree-View Items

You add an item to a tree-view control by sending the TVM_INSERTITEM message to the control. The message includes the address of a TVINSERTSTRUCT structure, specifying the parent item, the item after which the new item is inserted, and a TVITEM structure that defines the attributes of the item. The attributes include the item's label, its selected and nonselected images, and a 32-bit application-defined value.

The example in this section demonstrates how to create a table of contents based on the information in a text file. The example includes two functions. The first function searches a file for headings. When it finds one, it extracts the text of the heading and the value that indicates the level of the heading and then passes them to the second function.

The second function adds an item to a tree-view control, using the heading text as the item's label and the heading level to determine the parent item for the new item. A level one heading is added to the root of the tree-view control, a level two heading is added as a child item of the previous level one item, and so on. The function assigns an image to an item based on whether it has any child items. If an item has child items, it gets an image representing a closed folder. Otherwise, it gets an image representing a document. An item uses the same image for both the selected and nonselected states.

// InitTreeViewItems - extracts headings from the specified file and
// passes them to a function that adds them to a tree-view control.
// Returns TRUE if successful, or FALSE otherwise.
// hwndTV - handle to the tree-view control.
// lpszFileName - name of file with headings.

BOOL InitTreeViewItems(HWND hwndTV, LPSTR lpszFileName)
{
    HANDLE hf;            // handle to file
    char szItemText[128]; // label text of tree-view item
    int nLevel;           // heading level

    // Open the file to parse.
    if ((hf = CreateFile(lpszFileName,
                         GENERIC_READ,
                         FILE_SHARE_READ,
                         (LPSECURITY_ATTRIBUTES)NULL,
                         OPEN_EXISTING,
                         FILE_ATTRIBUTE_NORMAL,
                         (HANDLE)NULL)) == (HANDLE)INVALID_HANDLE_VALUE)
         return FALSE;

    // Call private function to parse the file looking for headings.
    while (GetNextHeadingAndLevelFromFile(hf, szItemText, &nLevel))

         // Add the item to the tree-view control.
         AddItemToTree(hwndTV, szItemText, nLevel);

    return TRUE;
}

// AddItemToTree - adds items to a tree-view control.
// Returns the handle to the newly added item.
// hwndTV - handle to the tree-view control.
// lpszItem - text of the item to add.
// nLevel - level at which to add the item.

HTREEITEM AddItemToTree(HWND hwndTV, LPSTR lpszItem, int nLevel)
{
    TVITEM tvi;
    TVINSERTSTRUCT tvins;
    static HTREEITEM hPrev = (HTREEITEM)TVI_FIRST;
    static HTREEITEM hPrevRootItem = NULL;
    static HTREEITEM hPrevLev2Item = NULL;
    HTREEITEM hti;

    tvi.mask = TVIF_TEXT | TVIF_IMAGE
               | TVIF_SELECTEDIMAGE | TVIF_PARAM;

    // Set the text of the item.
    tvi.pszText = lpszItem;
    tvi.cchTextMax = sizeof(tvi.pszText)/sizeof(tvi.pszText[0]);

    // Assume the item is not a parent item, so give it a
    // document image.
    tvi.iImage = g_nDocument;
    tvi.iSelectedImage = g_nDocument;

    // Save the heading level in the item's application-defined
    // data area.
    tvi.lParam = (LPARAM)nLevel;
    tvins.item = tvi;
    tvins.hInsertAfter = hPrev;

    // Set the parent item based on the specified level.
    if (nLevel == 1)
        tvins.hParent = TVI_ROOT;
    else if (nLevel == 2)
        tvins.hParent = hPrevRootItem;
    else
        tvins.hParent = hPrevLev2Item;

    // Add the item to the tree-view control.
    hPrev = (HTREEITEM)SendMessage(hwndTV,
                                   TVM_INSERTITEM,
                                   0,
                                   (LPARAM)(LPTVINSERTSTRUCT)&tvins);

    // Save the handle to the item.
    if (nLevel == 1)
        hPrevRootItem = hPrev;
    else if (nLevel == 2)
        hPrevLev2Item = hPrev;

    // The new item is a child item. Give the parent item a
    // closed folder bitmap to indicate it now has child items.
    if (nLevel > 1)
    {
        hti = TreeView_GetParent(hwndTV, hPrev);
        tvi.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;
        tvi.hItem = hti;
        tvi.iImage = g_nClosed;
        tvi.iSelectedImage = g_nClosed;
        TreeView_SetItem(hwndTV, &tvi);
    }

    return hPrev;
}

Dragging a Tree-View Item

Dragging a tree-view item typically involves processing the TVN_BEGINDRAG (or TVN_BEGINRDRAG ) notification message, the WM_MOUSEMOVE message, and the WM_LBUTTONUP (or WM_RBUTTONUP ) message. It also involves using the Image Lists functions to draw the item as it is being dragged.

The remainder of this section provides an example that demonstrates how to drag a tree-view item. The example consists of three functions. The first function begins the drag operation, the second drags the image, and the third ends the drag operation.

Beginning the tree-view drag operation

A tree-view control sends the parent window a TVN_BEGINDRAG (or TVN_BEGINRDRAG) notification message whenever the user starts to drag an item. The parent window receives the notification in the form of a WM_NOTIFY message whose lParam parameter is the address of an NMTREEVIEW structure. The members of this structure include the screen coordinates of the mouse pointer and a TVITEM structure that contains information about the item to be dragged.

The following example shows how to process the WM_NOTIFY message to obtain TVN_BEGINDRAG.

case WM_NOTIFY:
    switch (((LPNMHDR)lParam)->code)
    {
        case TVN_BEGINDRAG:
            //Main_OnBeginDrag is an application-defined function
            Main_OnBeginDrag(hwndTV, (LPNMTREEVIEW)lParam);
            break;

        // Handle other cases here.
    }
    break;

Beginning the drag operation involves using the ImageList_BeginDrag function. The function's parameters include the handle to the image list containing the image to use during the drag operation and the index of the image. You can either provide your own image list and image, or you can have the tree-view control create them for you by using the TVM_CREATEDRAGIMAGE message.

Because the drag image replaces the mouse pointer for the duration of the drag operation, ImageList_BeginDrag requires you to specify a hot spot within the image. The coordinates of the hot spot are relative to the upper left corner of the image. ImageList_BeginDrag also requires you to specify the initial location of the drag image. An application typically sets the initial location so that the hot spot of the drag image corresponds to that of the mouse pointer at the time the user began the drag operation.

The following function demonstrates how to begin dragging a tree-view item. It uses the drag image provided by the tree-view control and obtains the bounding rectangle of the item to determine the appropriate point for the hot spot. (The dimensions of the bounding rectangle are the same as those of the image.) Note that the bounding rectangle does not account for the indentation of child items. For this reason, the function adds the amount of indentation to the x-coordinate of the hot spot.

The function captures mouse input, causing mouse messages to be sent to the parent window. The parent window needs the subsequent WM_MOUSEMOVE messages to determine where to drag the image and the WM_LBUTTONUP message to determine when to end the drag operation.

// Main_OnBeginDrag - begins dragging an item in a tree-view control.
// hwndTV - handle to the image list.
// lpnmtv - address of information about the item being dragged.

void Main_OnBeginDrag(HWND hwndTV, LPNMTREEVIEW lpnmtv)
{
    HIMAGELIST himl;    // handle to image list
    RECT rcItem;        // bounding rectangle of item
    DWORD dwLevel;      // heading level of item
    DWORD dwIndent;     // amount that child items are indented

    // Tell the tree-view control to create an image to use
    // for dragging.
    himl = TreeView_CreateDragImage(hwndTV, lpnmtv->itemNew.hItem);

    // Get the bounding rectangle of the item being dragged.
    TreeView_GetItemRect(hwndTV, lpnmtv->itemNew.hItem, &rcItem, TRUE);

    // Get the heading level and the amount that the child items are
    // indented.
    dwLevel = lpnmtv->itemNew.lParam;
    dwIndent = (DWORD)SendMessage(hwndTV, TVM_GETINDENT, 0, 0);

    // Start the drag operation.
    ImageList_BeginDrag(himl, 0, 0, 0);
    ImageList_DragEnter(hwndTV, 50, 50);

    // Hide the mouse pointer, and direct mouse input to the
    // parent window.
    ShowCursor(FALSE);
    SetCapture(GetParent(hwndTV));
    g_fDragging = TRUE;

    return;

}

Dragging the tree-view item

You drag a tree-view item by calling the ImageList_DragMove function when the parent window receives a WM_MOUSEMOVE message, as the following example shows. The example also demonstrates how to perform hit testing during the drag operation to determine whether to highlight other items in the tree view as targets of a drag-and-drop operation.

// Main_OnMouseMove - drags an item in a tree-view control,
// highlighting the item that is the target.
// hwndParent - handle to the parent window.
// hwndTV - handle to the tree-view control.
// xCur and yCur - x- and y-coordinates of the mouse pointer.

void Main_OnMouseMove(HWND hwndParent, HWND hwndTV, LONG xCur, LONG yCur)
{
    HTREEITEM htiTarget;  // handle to target item
    TVHITTESTINFO tvht;  // hit test information

    if (g_fDragging)
    {
        // Drag the item to the current position of the mouse pointer.
        ImageList_DragMove(xCur, yCur);

        // Find out if the pointer is on the item. If it is,
        // highlight the item as a drop target.
        tvht.pt.x = xCur;
        tvht.pt.y = yCur;
        if ((htiTarget = TreeView_HitTest(hwndTV, &tvht)) != NULL)
        {
            TreeView_SelectDropTarget(hwndTV, htiTarget);
        }
    }
    return;
}

Ending the tree-view drag operation

The following example shows how to end a drag operation. The ImageList_EndDrag function is called when the parent window receives a WM_LBUTTONUP message.

// Main_OnLButtonUp - stops dragging a tree-view item, releases the
// mouse capture, and shows the mouse pointer.
//
// Global variable g_fDragging - indicates whether
// a drag operation is underway.

void Main_OnLButtonUp(void)
{
    if (g_fDragging)
    {
        ImageList_EndDrag();
        ReleaseCapture();
        ShowCursor(TRUE);
        g_fDragging = FALSE;
    }
    return;
}

Working with state image indexes

There is often confusion about how to set and retrieve the state image index in a tree-view control. The following examples demonstrate the proper method for setting and retrieving the state image index. The examples assume that there are only two state image indexes in the tree-view control, unchecked and checked. If your application contains more than two, these functions will need to be modified to handle that case.

The following example function illustrates how to set an item's check state.

BOOL TreeView_SetCheckState(HWND hwndTreeView, HTREEITEM hItem, BOOL fCheck)
{
    TVITEM tvItem;

    tvItem.mask = TVIF_HANDLE | TVIF_STATE;
    tvItem.hItem = hItem;
    tvItem.stateMask = TVIS_STATEIMAGEMASK;

    // Image 1 in the tree-view check box image list is the
    // unchecked box. Image 2 is the checked box.

    tvItem.state = INDEXTOSTATEIMAGEMASK((fCheck ? 2 : 1));

    return TreeView_SetItem(hwndTreeView, &tvItem);
}

The following example function illustrates how to retrieve an item's check state.

BOOL TreeView_GetCheckState(HWND hwndTreeView, HTREEITEM hItem)
{
    TVITEM tvItem;

    // Prepare to receive the desired information.
    tvItem.mask = TVIF_HANDLE | TVIF_STATE;
    tvItem.hItem = hItem;
    tvItem.stateMask = TVIS_STATEIMAGEMASK;

    // Request the information.
    TreeView_GetItem(hwndTreeView, &tvItem);

    // Return zero if it's not checked, or nonzero otherwise.
    return ((BOOL)(tvItem.state >> 12) -1);
}

Tree-View Control Updates in Internet Explorer

Tree-view controls in Microsoft® Internet Explorer support the following features.

ToolTips | Tree-view controls now automatically display ToolTips when an item is not entirely within the view area.
New Item State | Tree-view controls now support a new item state for parent items, TVIS_EXPANDPARTIAL. When a parent item is set to this state, the child items are displayed and the parent's plus sign remains visible. The TVM_EXPAND message and the TreeView_Expand macro have been updated to support this feature.
Single-Click Expansion | The TVS_SINGLEEXPAND style causes a tree-view item to be expanded when it becomes selected and to be closed when it becomes unselected.
Adjustable Maximum Scroll Time | The TVM_SETSCROLLTIME message allows you to set the maximum amount of time that a scroll operation can take. The TVM_GETSCROLLTIME message allows you to retrieve the maximum scroll time.


Up

Up-Down Controls

An up-down control is a pair of arrow buttons that the user can click to increment or decrement a value, such as a scroll position or a number displayed in a companion control. The value associated with an up-down control is called its current position. An up-down control is most often used with a companion control, which is called a buddy window.

  • About Up-Down Controls
  • Up-Down Control Updates in Internet Explorer

About Up-Down Controls

To the user, an up-down control and its buddy window often look like a single control. You can specify that an up-down control automatically position itself next to its buddy window and that it automatically set the caption of the buddy window to its current position. For example, you can use an up-down control with an edit control to prompt the user for numeric input. The following illustration shows an up-down control with an edit control as its buddy window, a combination that is sometimes referred to as a spinner control.

An up-down control without a buddy window functions as a sort of simplified scroll bar. For example, a tab control sometimes displays an up-down control to enable the user to scroll additional tabs into view. The following illustration shows an up-down control in the upper-right corner of a tab control.

You can create an up-down control and specify its buddy window in several ways. The UPDOWN_CLASS value specifies an up-down control's window class. You can specify this window class in a dialog box template or in a call to the CreateWindowEx function. Another way is to use the CreateUpDownControl function to create an up-down control and, at the same time, specify its buddy window, current position, and minimum and maximum positions.

The UPDOWN_CLASS window class is registered when the common controls dynamic-link library (DLL) is loaded. If you create an up-down control without using the CreateUpDownControl function, you must ensure that the DLL is loaded. You can do so by using the InitCommonControls function.

CreateUpDownControl enables you to specify a buddy window. If you create an up-down control without using this function, you can assign a buddy window by specifying the UDS_AUTOBUDDY window style or by using the UDM_SETBUDDY message. If UDS_AUTOBUDDY is specified, the up-down control automatically selects the previous window in the z-order as its buddy window. This window might be the previous control in a dialog box template. You can use UDM_SETBUDDY to assign a specific buddy window to an up-down control. To determine an up-down control's current buddy window, use the UDM_GETBUDDY message. An up-down control and its buddy window must have the same parent window.

An up-down control notifies its parent window when its current position changes by sending it a UDN_DELTAPOS notification message and a WM_VSCROLL or WM_HSCROLL message. A vertical up-down control (which does not have the UDS_HORZ style) sends a WM_VSCROLL message. A horizontal up-down control (which has the UDS_HORZ style) sends a WM_HSCROLL message.

The following topics are discussed in this section.

  • About Up-Down Control Styles
  • Position and Acceleration
  • Default Up-Down Controls Message Processing

About Up-Down Control Styles

Using window styles, you can manipulate characteristics of an up-down control, such as how it positions itself relative to its buddy window, whether it sets the text of its buddy window, and whether it processes the UP ARROW and DOWN ARROW keys.

An up-down control with the UDS_ALIGNLEFT or UDS_ALIGNRIGHT style aligns with the left or right edge of its buddy window. The width of the buddy window is decreased to accommodate the width of the up-down control.

An up-down control with the UDS_SETBUDDYINT style sets the caption of its buddy window whenever the current position changes. The control inserts a thousands separator between every three digits of a decimal string unless the UDS_NOTHOUSANDS style is specified. If the buddy window is a list box, an up-down control sets its current selection instead of its caption.

You can specify the UDS_ARROWKEYS style to provide a keyboard interface for an up-down control. If this style is specified, the control processes the and keys. The control also subclasses the buddy window so that it can process these keys when the buddy window has the focus.

If you use an up-down control for horizontal scrolling, you can specify the UDS_HORZ style. This style causes the up-down control's arrows to point left and right instead of up and down.

By default, the current position does not change if the user attempts to increment it or decrement it beyond the maximum or minimum value. You can change this behavior by using the UDS_WRAP style, so the position "wraps" to the opposite extreme. For example, incrementing past the upper limit wraps the position back to the lower limit.

Position and Acceleration

After an up-down control is created, you can change the control's current position, minimum position, and maximum position by sending messages. You can also change the radix base used to display the current position in the buddy window and the rate at which the current position changes when the up or down arrow is clicked.

To retrieve the current position of an up-down control, use the UDM_GETPOS message. For an up-down control with a buddy window, the current position is the number in the buddy window's caption. Because the caption may have changed (for example, the user may have edited the text of an edit control), the up-down control retrieves the current caption and updates its current position accordingly.

The buddy window's caption may be either a decimal or hexadecimal string, depending on the radix base (that is, either base 10 or 16) of the up-down control. You can set the radix base by using the UDM_SETBASE message and retrieve the radix base by using the UDM_GETBASE message.

The UDM_SETPOS message sets the current position of a buddy window. Note that unlike a scroll bar, an up-down control automatically changes its current position when the up and down arrows are clicked. An application, therefore, does not need to set the current position when processing the WM_VSCROLL or WM_HSCROLL message.

You can change the minimum and maximum positions of an up-down control by using the UDM_SETRANGE message. The maximum position may be less than the minimum, and in that case clicking the up arrow button decreases the current position. To put it another way, up means moving towards the maximum position. To retrieve the minimum and maximum positions for an up-down control, use the UDM_GETRANGE message.

You can control the rate at which the position changes when the user holds down an arrow button by setting the up-down control's acceleration. The acceleration is defined by an array of UDACCEL structures. Each structure specifies a time interval and the number of units by which to increment or decrement at the end of that interval. To set the acceleration, use the UDM_SETACCEL message. To retrieve acceleration information, use the UDM_GETACCEL message.

Default Up-Down Controls Message Processing

This section describes the standard Windows messages processed by an up-down control.

Message | Processing performed
WM_CREATE | Allocates and initializes a private data structure and saves its address as window data.
WM_DESTROY | Frees data allocated during WM_CREATE processing.
WM_ENABLE | Invalidates the window.
WM_KEYDOWN | Changes the current position in the case of an UP ARROW or DOWN ARROW key.
WM_KEYUP | Completes the position change.
WM_LBUTTONDOWN | Captures the mouse. If the buddy window is an edit control or list box, it sets the focus to the buddy window. If the mouse is over the up or down button, it begins changing the position and sets a timer.
WM_LBUTTONUP | Completes the position change and releases the mouse capture if the up-down control has captured the mouse. If the buddy window is an edit control, it selects all the text in the edit control.
WM_PAINT | Paints the up-down control. If the wParam parameter is non-NULL, the control assumes that the value is an HDC and paints using that device context.
WM_TIMER | Changes the current position if the mouse is being held down over a button and a sufficient interval has elapsed.

Up-Down Control Updates in Internet Explorer

Up-down controls in Microsoft® Internet Explorer support the following new feature.

Full 32-bit Range
The up-down control now supports a full 32-bit range. The UDM_SETRANGE32 and UDM_GETRANGE32 messages have been added to support this feature. The up-down control uses signed integers for its range, so it is necessary to set the range from -0x7FFFFFFF to +0x7FFFFFFF to utilize the full 32-bit range.


Color Dialog Box

The Color dialog box returns the RGB value of a color selected by the user. The user can select from a set of basic colors determined by the display driver or from a set of custom colors. You must specify the initial set of custom colors, but you can allow users to create their own custom colors.

You create and display a Color dialog box by initializing a CHOOSECOLOR structure and passing the structure to the ChooseColor function.

You can partially open the Color dialog box to display the basic and custom colors from which the user can select, or you can completely open the dialog box to display additional controls that allow the user to create custom colors. The following illustration shows the fully opened Color dialog box.

If the user clicks the OK button, ChooseColor returns TRUE. The rgbResult member of the CHOOSECOLOR structure contains the RGB color value of the color selected by the user. The RGB color value specifies the intensities of the individual red, green, and blue colors that make up the selected color. The individual values range from 0 through 255. Use the GetRValue , GetGValue , and GetBValue macros to extract individual colors from an RGB color value.

If the user cancels the Color dialog box or an error occurs, ChooseColor returns FALSE and the rgbResult member is not defined. To determine the cause of the error, call the CommDlgExtendedError function to retrieve the extended error value.

The following subjects are covered in this section

  • Basic and Extended Color Dialog Boxes
  • Customizing the Color Dialog Box
  • Color Models Used by the Color Dialog Box

Basic and Extended Color Dialog Boxes

The Color dialog box has a basic version and an extended version. The basic version has controls that display the basic and custom colors from which the user can select. The extended version includes the basic controls and has additional controls that allow the user to create custom colors.

The basic version of the Color dialog box includes a Define Custom Colors button. The user can click this button to display the extended version. You can direct the Color dialog box to always display this extension by setting the CC_FULLOPEN flag in the Flags member of the CHOOSECOLOR structure. To prevent the user from creating custom colors, you can set the CC_PREVENTFULLOPEN flag to disable the Define Custom Colors button.

The basic colors represent a selection of the colors available on the specified device. The actual number of colors displayed is determined by the display driver. For example, a VGA driver displays 48 colors, and a monochrome display driver displays only 16.

The custom colors are those that you specify or that the user creates. When you create a Color dialog box, you must use the lpCustColors member of the CHOOSECOLOR structure to specify the initial values for the 16 custom colors. If the extended version of the Color dialog box is open, the user can create a custom color by one the following methods:

  • Moving the cursor in the color spectrum control and the luminosity slide control
  • Typing RGB values in the Red, Green, and Blue edit controls
  • Typing hue, saturation, luminosity (HSL) values in the Hue, Sat, and Lum edit controls

To add a new custom color to the custom colors display, the user can click the Add to Custom Colors button. This also causes the dialog box to copy the RGB value of the new color to the corresponding element in the array pointed to by the lpCustColors member. To preserve new custom colors between calls to ChooseColor, you should allocate static memory for the array. For more information about the RGB and HSL color models, see Color Models Used by the Color Dialog Box.

Customizing the Color Dialog Box

To customize a Color dialog box, you can use any of the following methods:

  • Specify values in the CHOOSECOLOR structure when you create the dialog box
  • Provide a custom template
  • Provide a hook procedure

You can modify the appearance and behavior of the Color dialog box by setting flags in the Flags member of the CHOOSECOLOR structure. For example, you can set the CC_SOLIDCOLOR flag to direct the dialog box to display only solid colors. To cause the dialog box to initially select a color other than black, set the CC_RGBINIT flag and specify a color in the rgbResult member.

You can provide a custom template for the Color dialog box, for example, if you want to include additional controls that are unique to your application. The ChooseColor function uses your custom template in place of the default template.

To provide a custom template for the Color dialog box

  1. Create the custom template by modifying the default template specified in the Color.dlg file. The control identifiers used in the default Color dialog template are defined in the Color.dlg file.
  2. Use the CHOOSECOLOR structure to enable the template as follows:
    • If your custom template is a resource in an application or dynamic link library, set the CC_ENABLETEMPLATE flag in the Flags member. Use the hInstance and lpTemplateName members of the structure to identify the module and resource name.

      -Or-

    • If your custom template is already in memory, set the CC_ENABLETEMPLATEHANDLE flag. Use the hInstance member to identify the memory object that contains the template.

You can provide a CCHookProc hook procedure for the Color dialog box. The hook procedure can process messages sent to the dialog box. It can also use registered messages to control the behavior of the dialog box. If you use a custom template to define additional controls, you must provide a hook procedure to process input for your controls.

To enable a hook procedure for the Color dialog box

  1. Set the CC_ENABLEHOOK flag in the Flags member of the CHOOSECOLOR structure.
  2. Specify the address of the hook procedure in the lpfnHook member.

After processing its WM_INITDIALOG message, the dialog box procedure sends a WM_INITDIALOG message to the hook procedure. The lParam parameter of this message is a pointer to the CHOOSECOLOR structure used to initialize the dialog box.

The dialog box sends the COLOROKSTRING registered message to the hook procedure when the user clicks the OK button. The hook procedure can reject the selected color and force the dialog box to remain open by returning zero when it receives this message. The hook procedure can force the dialog box to select a particular color by sending the SETRGBSTRING registered message to the dialog box. To use these registered messages, you must pass the COLOROKSTRING and SETRGBSTRING constants to the RegisterWindowMessage function to get a message identifier. You can then use the identifier to detect and process messages sent from the dialog box, or to send messages to the dialog box.

Color Models Used by the Color Dialog Box

The custom colors extension of the Color dialog box allows the user to specify a color using RGB or HSL values. However, the CHOOSECOLOR structure uses only RGB values to report the colors created or selected by the user.

  • RGB Color Model
  • HSL Color Model
  • Converting HSL Values to RGB Values

RGB Color Model

The RGB model is used to designate colors for displays and other devices that emit light. Valid red, green, and blue values range from 0 through 255, with 0 indicating minimum intensity and 255 indicating maximum intensity. The following illustration shows how the primary colors red, green, and blue can be combined to produce four additional colors. (For display devices, the color black results when the red, green, and blue values are set to 0. In display technology, black is the absence of all colors.)

Following are eight colors and their associated RGB values.

Color | RGB values
Red | 255, 0, 0
Green | 0, 255, 0
Blue | 0, 0, 255
Cyan | 0, 255, 255
Magenta | 255, 0, 255
Yellow | 255, 255, 0
White | 255, 255, 255
Black | 0, 0, 0

The system stores internal colors as 32-bit RGB values that have the following hexadecimal form:

    0x00bbggrr

The low-order byte contains a value for the relative intensity of red; the second byte contains a value for green; and the third byte contains a value for blue. The high-order byte must be zero.

You can use the RGB macro to get an RGB value based on specified intensities for the red, green, and blue components. Use the GetRValue, GetBValue, and GetGValue macros to extract individual colors from an RGB color value.

HSL Color Model

The Color dialog box provides controls for specifying HSL values. The following illustration shows the color spectrum control and the luminosity slide control that appear in the Color dialog box. The illustration also shows the ranges of values the user can specify with these controls.

In the Color dialog box, the saturation and luminosity values must be in the range 0 through 240, and the hue value must be in the range 0 through 239.

Converting HSL Values to RGB Values

The dialog box procedure provided in Comdlg32.dll for the Color dialog box contains code that converts HSL values to the corresponding RGB values. Following are several colors and their associated HSL and RGB values.

Color | HSL values | RGB values
Red | (0, 240, 120) | (255, 0, 0)
Yellow | (40, 240, 120) | (255, 255, 0)
Green | (80, 240, 120) | (0, 255, 0)
Cyan | (120, 240, 120) | (0, 255, 255)
Blue | (160, 240, 120) | (0, 0, 255)
Magenta | (200, 240, 120) | (255, 0, 255)
White | (0, 0, 240) | (255, 255, 255)
Black | (0, 0, 0) | (0, 0, 0)

Choosing a Color

This topic describes sample code that displays a Color dialog box so a user can select a color. The sample code first initializes a CHOOSECOLOR structure, and then calls the ChooseColor function to display the dialog box. If the function returns TRUE, indicating that the user selected a color, the sample code uses the selected color to create a new solid brush.

This example uses the CHOOSECOLOR structure to initialize the dialog box as follows:

  • Initializes the lpCustColors member with a pointer to a static array of values. The colors in the array are initially black, but the static array preserves custom colors created by the user for subsequent ChooseColor calls.
  • Sets the CC_RGBINIT flag and initializes the rgbResult member to specify the color that is initially selected when the dialog box opens. If not specified, the initial selection is black. The example uses the rgbCurrent static variable to preserve the selected value between calls to ChooseColor.
  • Sets the CC_FULLOPEN flag so the custom colors extension of the dialog box is always displayed.
CHOOSECOLOR cc;                 // common dialog box structure
static COLORREF acrCustClr[16]; // array of custom colors
HWND hwnd;                      // owner window
HBRUSH hbrush;                  // brush handle
static DWORD rgbCurrent;        // initial color selection

// Initialize CHOOSECOLOR
ZeroMemory(&cc, sizeof(cc));
cc.lStructSize = sizeof(cc);
cc.hwndOwner = hwnd;
cc.lpCustColors = (LPDWORD) acrCustClr;
cc.rgbResult = rgbCurrent;
cc.Flags = CC_FULLOPEN | CC_RGBINIT;

if (ChooseColor(&cc)==TRUE) {
    hbrush = CreateSolidBrush(cc.rgbResult);
    rgbCurrent = cc.rgbResult;
}


Find and Replace Dialog Boxes

The Find dialog box lets the user specify a string to search for, as well as options to use when searching for text in a document. The Replace dialog box lets the user specify a string to search for and a replacement string, as well as options to control the operation.

You create and display a Find dialog box by initializing a FINDREPLACE structure and passing the structure to the FindText function. You create and display a Replace dialog box by initializing a FINDREPLACE structure and passing the structure to the ReplaceText function.

The following illustration shows a typical Find dialog box.

The following illustration shows a typical Replace dialog box.

Unlike other common dialog boxes, the Find and Replace dialog boxes are modeless. A modeless dialog box allows the user to switch between the dialog box and the window that created it. This is useful for letting the user search for a string, switch to the application window to work on the string, and switch back to the dialog box to search for another string without repeating the command needed to open the dialog box.

If the FindText or ReplaceText function successfully creates the dialog box, it returns a handle to the dialog box. You can use this handle to move and communicate with the dialog box. If the function cannot create the dialog box, it returns NULL. You can determine the cause of an error by calling the CommDlgExtendedError function to retrieve the extended error value.

This section discusses the following topics.

  • The FINDMSGSTRING Registered Message
  • Customizing the Find or Replace Dialog Box
  • Example.

The FINDMSGSTRING Registered Message

Before creating a Find or Replace dialog box, you must call the RegisterWindowMessage function to get a message identifier for the FINDMSGSTRING registered message. You can then use the identifier to detect and process messages sent from the dialog box. When the user clicks the Find Next, Replace, or Replace All button in a dialog box, the dialog box procedure sends a FINDMSGSTRING message to the window procedure of the owner window. When you create the dialog box, the hwndOwner member of the FINDREPLACE structure identifies the owner window.

The lParam parameter of a FINDMSGSTRING message is a pointer to the FINDREPLACE structure that you specified when you created the dialog box. Before sending the message, the dialog box sets the members of this structure with the latest user input, including the string to search for, the replacement string (if any), and options for the find-and-replace operation.

In a FINDMSGSTRING message, the Flags member of the FINDREPLACE structure includes one of the following flags to indicate the event that caused the message.

Flag | Meaning
FR_DIALOGTERM | The dialog box is closing. After the owner window processes this message, a handle to the dialog box is no longer valid.
FR_FINDNEXT | The user clicked the Find Next button in a Find or Replace dialog box. The lpstrFindWhat member specifies the string to search for.
FR_REPLACE | The user clicked the Replace button in a Replace dialog box. The lpstrFindWhat member specifies the string to replace and the lpstrReplaceWith member specifies the replacement string.
FR_REPLACEALL | The user clicked the Replace All button in a Replace dialog box. The lpstrFindWhat member specifies the string to replace and the lpstrReplaceWith member specifies the replacement string.

For a Find Next or Replace All message, the Flags member can include any combination of the following flags to indicate the search options.

Flag | Meaning
FR_DOWN | If set, the Down button of the direction radio buttons is selected, indicating that user wants to search from the current location to the end of the document. If FR_DOWN is not set, the Up button is selected so the user wants to search to the beginning of the document.
FR_MATCHCASE | If set, the Match Case check box is selected, indicating that the user wants the search to be case sensitive. If FR_MATCHCASE is not set, the check box is unselected so that the search can be case insensitive.
FR_WHOLEWORD | If set, the Match Whole Word Only check box is selected, indicating that the user wants to search only for whole words that match the search string. If FR_WHOLEWORD is not set, the check box is unselected so you should also search for word fragments that match the search string.

Customizing the Find or Replace Dialog Box

To customize a Find or Replace dialog box, you can use any of the following methods:

  • Specify values in the FINDREPLACE structure when you create the dialog box
  • Provide a custom template
  • Provide a hook procedure

When you create a Find or Replace dialog box, you can set flags in the Flags member of the FINDREPLACE structure to hide or disable any of the search option controls. For example, you can set the FR_NOMATCHCASE flag to disable the Match Case check box or set the FR_HIDEMATCHCASE flag to hide it.

You can provide a custom template for a Find or Replace dialog box, for example, if you want to include additional controls that are unique to your application. The FindText and ReplaceText functions use your custom template in place of the default template.

To provide a custom template for a Find or Replace dialog box

  1. Create the custom template by modifying the default template specified in the Findtext.dlg file. The control identifiers used in the default Find or Replace dialog template are defined in the Dlgs.h file.
  2. Use the FINDREPLACE structure to enable the template as follows:
      • If your custom template is a resource in an application or dynamic-link library, set the FR_ENABLETEMPLATE flag in the Flags member. Use the hInstance and lpTemplateName members of the structure to identify the module and resource name.

        -Or-

      • If your custom template is already in memory, set the FR_ENABLETEMPLATEHANDLE flag. Use the hInstance member to identify the memory object that contains the template.

You can provide an FRHookProc hook procedure for a Find or Replace dialog box. The hook procedure can process messages sent to the dialog box. If you use a custom template to define additional controls, you must provide a hook procedure to process input for your controls.

To enable a hook procedure for a Find or Replace dialog box

  1. Set the FR_ENABLEHOOK flag in the Flags member of the FINDREPLACE structure.
  2. Specify the address of the hook procedure in the lpfnHook member.

After processing its WM_INITDIALOG message, the dialog box procedure sends a WM_INITDIALOG message to the hook procedure. The lParam parameter of this message is a pointer to the FINDREPLACE structure used to initialize the dialog box.

If the hook procedure returns FALSE in response to the WM_INITDIALOG message, the dialog box will not be shown unless the hook procedure displays it. To do this, first perform any other paint operations, and then call the ShowWindow and UpdateWindow functions. The following code provides an example:

// We've returned FALSE in response to WM_INITDIALOG.
// We've performed any other paint operations.
// Now we display the dialog box.
ShowWindow(hDlg, SW_SHOWNORMAL);
UpdateWindow(hDlg);

Finding Text

This topic describes sample code that displays and manages a Find dialog box so the user can specify the parameters of a search operation. The dialog box sends messages to your window procedure so you can perform the search operation.

The code for displaying and managing a Replace dialog box is similar, except that it uses the ReplaceText function to display the dialog box. The Replace dialog box also sends messages in response to user clicks on the Replace and Replace All buttons.

To use the Find or Replace dialog box, you must perform three separate tasks:

  1. Get a message identifier for the FINDMSGSTRING registered message.
  2. Display the dialog box.
  3. Process FINDMSGSTRING messages when the dialog box is open.

When you initialize your application, call the RegisterWindowMessage function to get a message identifier for the FINDMSGSTRING registered message.

UINT uFindReplaceMsg;  // message identifier for FINDMSGSTRING

uFindReplaceMsg = RegisterWindowMessage(FINDMSGSTRING);

To display a Find dialog box, first initialize a FINDREPLACE structure and then call the FindText function. Note that the FINDREPLACE structure and the buffer for the search string should be a global or static variable so it does not go out of scope before the dialog box closes. You must set the hwndOwner member to specify the window that receives the registered messages. After you create the dialog box, you can move or manipulate it by using the returned handle.

FINDREPLACE fr;       // common dialog box structure
HWND hwnd;            // owner window
CHAR szFindWhat[80];  // buffer receiving string
HWND hdlg = NULL;     // handle to Find dialog box

// Initialize FINDREPLACE
ZeroMemory(&fr, sizeof(fr));
fr.lStructSize = sizeof(fr);
fr.hwndOwner = hwnd;
fr.lpstrFindWhat = szFindWhat;
fr.wFindWhatLen = 80;
fr.Flags = 0;

hdlg = FindText(&fr);

When the dialog box is open, your main message loop must include a call to the IsDialogMessage function. Pass a handle to the dialog box as a parameter in the IsDialogMessage call. This ensures that the dialog box correctly processes keyboard messages.

To monitor messages sent from the dialog box, your window procedure must check for the FINDMSGSTRING registered message and process the values passed in the FINDREPLACE structure as in the following example:

LPFINDREPLACE lpfr;

if (message == uFindReplaceMsg){

    // Get pointer to FINDREPLACE structure from lParam.

    lpfr = (LPFINDREPLACE)lParam;

    // If the FR_DIALOGTERM flag is set,
    // invalidate the handle identifying the dialog box.

    if (lpfr->Flags & FR_DIALOGTERM){
        hdlg = NULL;
        return 0;
        }

    // If the FR_FINDNEXT flag is set,
    // call the application-defined search routine
    // to search for the requested string.

    if (lpfr->Flags & FR_FINDNEXT)
        SearchFile(lpfr->lpstrFindWhat,
                   (BOOL) (lpfr->Flags & FR_DOWN),
                   (BOOL) (lpfr->Flags & FR_MATCHCASE));

    return 0;

}


Font Dialog Box

The Font dialog box lets the user choose attributes for a logical font, such as typeface name, style (bold, italic, or regular), point size, effects (underline, strikeout, and text color), and a script (or character set).

You create and display a Font dialog box by initializing a CHOOSEFONT structure and passing the structure to the ChooseFont function.

The following illustration shows a typical Font dialog box.

If the user clicks the OK button, ChooseFont returns TRUE and sets the members of the LOGFONT structure pointed to by the lpLogFont member of the CHOOSEFONT structure. You can use the LOGFONT structure with the function to create a logical font. ChooseFont also sets other CHOOSEFONT members to indicate the user's selections.

If the user cancels the Font dialog box or an error occurs, ChooseFont returns FALSE and the contents of the LOGFONT structure are not defined. You can determine the cause of an error by using the CommDlgExtendedError function to retrieve the extended error value.

The following topics are discussed in this section.

  • Font Dialog Initialization Flags
  • Customizing the Font Dialog Box

Font Dialog Initialization Flags

Before calling ChooseFont, the Flags member of the CHOOSEFONT structure must specify CF_SCREENFONTS, CF_PRINTERFONTS, or CF_BOTH, to indicate whether the dialog box should list screen fonts, printer fonts, or both. If you specify CF_PRINTERFONTS or CF_BOTH, the hDC member of the CHOOSEFONT structure must specify a handle to a device context for the printer.

You can use the Flags member to enable or disable some of the dialog box controls, and you can use the Flags member in conjunction with other CHOOSEFONT members to control the initial values of some controls.

To display the controls that allow the user to select strikeout, underline, and color options

  • Set the CF_EFFECTS flag. You can use the rgbColors member of the CHOOSEFONT structure to specify an initial font color.

To specify the initial values of the Font, Font Style, Size, Strikeout, and Underline dialog box controls

  • Set the CF_INITTOLOGFONTSTRUCT flag to use members of the LOGFONT structure to specify the initial values.
  • You can also use the CF_NOFACESEL, CF_NOSTYLESEL, and CF_NOSIZESEL flags to selectively prevent the dialog box from displaying initial values for the corresponding controls. This is useful when working with a selection of text that has more than one typeface, style, or point size. These values will also be set in Flags when ChooseFont returns if the user did not select a corresponding value.

To initialize the Font Style control to a specified style name

  • Set the CF_USESTYLE flag and use the lpszStyle member to specify the style name.

To display the Apply button

  • Set the CF_APPLY flag and provide a hook procedure to process WM_COMMAND messages for the Apply button. The hook procedure can send the WM_CHOOSEFONT_GETLOGFONT message to the dialog box to retrieve the address of the LOGFONT structure that contains the current selections for the font.

To display the Help button

  • Set the CF_SHOWHELP flag. The hwndOwner member must identify the window to receive the HELPMSGSTRING registered message when the user clicks the Help button.

To restrict the fonts the dialog box displays

  • Set any combination of the CF_TTONLY, CF_FIXEDPITCHONLY, CF_NOVECTORFONTS, CF_NOVERTFONTS, CF_SCALABLEONLY, and CF_WYSIWYG flags. You can also restrict the available styles, point sizes, and effects the dialog box displays for some fonts by using the CF_NOSIMULATIONS value.

To restrict the typeface names, styles, and point sizes that the user can specify

  • Set the CF_FORCEFONTEXIST flag to restrict the user to specifying only valid typeface names, styles, and point sizes.
  • Set the CF_LIMITSIZE flag to restrict the user to specifying point sizes in the range specified by the nSizeMin and nSizeMax members.

To restrict or disable the Scripts combo box

  • Set the CF_NOSCRIPTSEL flag to disable the Scripts combo box, or set the CF_SELECTSCRIPT flag to restrict selections in the Scripts combo box to a specified character set.

Customizing the Font Dialog Box

You can provide a custom template for the Font dialog box, for example, if you want to include additional controls that are unique to your application. The ChooseFont function uses your custom template in place of the default template.

To provide a custom template for the Font dialog box

  1. Create the custom template by modifying the default template specified in the Font.dlg file. The control identifiers used in the default Font dialog template are defined in the Dlgs.h file.
  2. Use the CHOOSEFONT structure to enable the template as follows:
      • If your custom template is a resource in an application or dynamic link library, set the CF_ENABLETEMPLATE flag in the Flags member. Use the hInstance and lpTemplateName members of the structure to identify the module and resource name.

        -Or-

      • If your custom template is already in memory, set the CF_ENABLETEMPLATEHANDLE flag. Use the hInstance member to identify the memory object that contains the template.

You can provide a CCHookProc hook procedure for the Font dialog box. The hook procedure can process messages sent to the dialog box. It can also send messages to the dialog box. If you use a custom template to define additional controls, you must provide a hook procedure to process input for your controls.

To enable a hook procedure for the Font dialog box

  1. Set the CF_ENABLEHOOK flag in the Flags member of the CHOOSEFONT structure.
  2. Specify the address of the hook procedure in the lpfnHook member.

After processing its WM_INITDIALOG message, the dialog box procedure sends a WM_INITDIALOG message to the hook procedure. The lParam parameter of this message is a pointer to the CHOOSEFONT structure used to initialize the dialog box.

The hook procedure can send the WM_CHOOSEFONT_GETLOGFONT, WM_CHOOSEFONT_SETLOGFONT , and WM_CHOOSEFONT_SETFLAGS messages to the dialog box to get and set the current values and flags of the dialog box.

Choosing a Font

This topic describes sample code that displays a Font dialog box so a user can choose the attributes of a font. The sample code first initializes a CHOOSEFONT structure, and then calls the ChooseFont function to display the dialog box.

This example sets the CF_SCREENFONTS flag to specify that the dialog box should display only screen fonts. It sets the CF_EFFECTS flag to display controls that allow the user to select strikeout, underline, and color options.

If ChooseFont returns TRUE, indicating that the user clicked the OK button, the structure pointed to by the lpLogFont member of the CHOOSEFONT structure contains information that describes the font and font attributes selected by the user. The rgbColors member contains the selected text color. The sample code uses this information to set the font and text color for the device context associated with the owner window.

HWND hwnd;                // owner window
HDC hdc;                  // display device context of owner window

CHOOSEFONT cf;            // common dialog box structure
static LOGFONT lf;        // logical font structure
static DWORD rgbCurrent;   // current text color
HFONT hfont, hfontPrev;
DWORD rgbPrev;

// Initialize CHOOSEFONT
ZeroMemory(&cf, sizeof(cf));
cf.lStructSize = sizeof (cf);
cf.hwndOwner = hwnd;
cf.lpLogFont = &lf;
cf.rgbColors = rgbCurrent;
cf.Flags = CF_SCREENFONTS | CF_EFFECTS;

if (ChooseFont(&cf)==TRUE) {
    hfont = CreateFontIndirect(cf.lpLogFont);
    hfontPrev = SelectObject(hdc, hfont);
    rgbCurrent= cf.rgbColors;
    rgbPrev = SetTextColor(hdc, rgbCurrent);
 .
 .
 .
}


Open and Save As Dialog Boxes

The Open dialog box lets the user specify the drive, directory, and the name of a file or set of files to open. You create and display an Open dialog box by initializing an OPENFILENAME structure and passing the structure to the GetOpenFileName function.

The Save As dialog box lets the user specify the drive, directory, and name of a file to save. You create and display a Save As dialog box by initializing an OPENFILENAME structure and passing the structure to the GetSaveFileName function.

Explorer-style Open and Save As dialog boxes provide user-interface features that are similar to the Microsoft® Windows® Explorer. However, the system continues to support old-style Open and Save As dialog boxes for applications that must be consistent with the old-style user interface.

In addition to the difference in appearance, the Explorer-style and old-style dialog boxes differ in their use of custom templates and hook procedures for customizing the dialog boxes. However, the Explorer-style and old-style dialog boxes have the same behavior for most basic operations, such as specifying a file name filter, validating the user's input, and getting the file name specified by the user. For more information about the Explorer-style and old-style dialog boxes, see Open and Save As Dialog Box Customization.

The following illustration shows a typical Explorer-style Open dialog box.

If the user specifies a file name and clicks the OK button, GetOpenFileName or GetSaveFileName returns TRUE. The buffer pointed to by the lpstrFile member of the OPENFILENAME structure contains the full path and file name specified by the user.

If the user cancels the Open or Save As dialog box or an error occurs, the function returns FALSE. To determine the cause of the error, call the CommDlgExtendedError function to retrieve the extended error value. If the lpstrFile buffer is too small to receive the full name, CommDlgExtendedError returns FNERR_BUFFERTOOSMALL and the first 2 bytes of the buffer pointed to by the lpstrFile member are set to an integer value specifying the size required to receive the full name.

Explorer style dialog boxes are only available to 32-bit applications. 16-bit applications cannot use thunking to display an Explorer-style dialog box.

Windows 95/98/Me: Win32-based applications that use the old-style dialog boxes do so using a thunk. This means that any pointer passed to your hook procedure is a nonpersistent copy of the data. For example, the OPENFILENAME pointer passed in the WM_INITDIALOG message is not a pointer to the buffer that you originally specified. If you need to pass private data to your hook procedure, bundle it in a structure and store a pointer to the structure in the lCustData member of the OPENFILENAME structure.

The following topics are discussed in this section.

  • File Names and Directories
  • Filters
  • File and Directory Validation
  • Open and Save As Dialog Box Customization
  • Explorer-Style Hook Procedures
  • Explorer-Style Custom Templates
  • Explorer-Style Control Identifiers
  • Customizing Old-Style Dialog Boxes
  • Example

File Names and Directories

The information in this section applies to both Explorer-style and old-style Open and Save As dialog boxes.

Before calling the GetOpenFileName or GetSaveFileName functions, the lpstrFile member of the OPENFILENAME structure must point to the buffer to receive the file name. The nMaxFile member must specify the size, in TCHARs, of the lpstrFile buffer. For an ANSI function this is the number of bytes, but for a Unicode function this is the number of characters.

If the user specifies a file name and clicks the OK button, the dialog box copies the selected drive, directory, and file name to the lpstrFile buffer. The function also sets the nFileOffset and nFileExtension members to the offsets, in TCHARs, from the start of the buffer to the file name and to the file name extension, respectively.

To retrieve just the file name and extension, set the lpstrFileTitle member to point to a buffer and set the nMaxFileTitle member to the size, in TCHARs, of the buffer. Alternatively, you can pass the lpstrFile buffer in a call to the GetFileTitle function to get the display name of the selected file. Note, however, that the file name that GetFileTitle returns includes an extension only if that is the user's preference for displaying file names.

The dialog box uses the current directory for the calling process as the initial directory from which to display files and directories. Use the or functions to get or change your current directory. To specify a different initial directory without changing your current directory, use the lpstrInitialDir member to specify the name of a directory. The dialog box automatically changes your current directory when the user selects a different drive or directory. To prevent the dialog box from changing your current directory, set the OFN_NOCHANGEDIR flag. This flag does not prevent the user from changing directories to find a file.

To specify a default file name extension, use the lpstrDefExt member. If the user specifies a file name that does not have an extension, the dialog box adds your default extension. If you specify a default extension and the user specifies a file name with a different extension, the dialog box sets the OFN_EXTENSIONDIFFERENT flag.

To let the user select more than one file from a directory, set the OFN_ALLOWMULTISELECT flag. For compatibility with older applications, the default multiple selection dialog box uses the old-style user interface. To display an Explorer-style multiple selection dialog box, you must also set the OFN_EXPLORER flag.

If the user selects more than one file, the buffer pointed to by the lpstrFile member returns the path to the current directory followed by the file names of the selected files. The nFileOffset member is the offset to the first file name, and the nFileExtension member is not used. The following table describes the difference between Explorer-style and old-style dialog boxes in returning multiple file names.

Dialog box style | Description
Explorer-style dialog boxes | The directory and file name strings are NULL separated, with an extra NULL character after the last file name. This format enables the Explorer-style dialog boxes to return long file names that include spaces.
Old-style dialog boxes | The directory and file name strings are separated by spaces. For file names with spaces, the function uses short file names.

You can use the FindFirstFile function to convert between long and short file names.

If you specify OFN_ALLOWMULTISELECT and the user selects only one file, the lpstrFile string does not have a separator between the path and file name.

Filters

The information in this section applies to both Explorer-style and old style Open and Save As dialog boxes.

You can provide file name filters to assist the user in limiting the file names that the dialog box displays. A file name filter consists of a pair of null-terminated strings, a description and a pattern, one concatenated to the other. The dialog box displays the description to let the user pick which filter to use; and it uses the pattern to select the files to display.

To specify the filters, set the lpstrFilter member of the OPENFILENAME structure to point to a buffer that contains an array of filter string pairs. The last string in the array must be followed by an extra null character.

A pattern string can be a combination of valid file name characters and the asterisk (*). The asterisk is a wildcard that represents any combination of valid file name characters. The dialog box displays only those files that match the pattern. To specify multiple patterns for the same description, you must use a semicolon (;) to separate the patterns. Note that space characters in the pattern string can produce unexpected results.

The following code fragment specifies two filters. The filter with the "Source" description has two patterns. If the user selects this filter, the dialog box displays only files that have the .C and .CXX extensions. Note, in the C programming language, a string enclosed in double quotes is null-terminated.

OPENFILENAME ofn;       // common dialog box structure

ofn.lpstrFilter = "Source\0*.C;*.CXX\0All\0*.*\0"
ofn.nFilterIndex = 1;

The nFilterIndex member of the OPENFILENAME structure specifies an index that indicates which filter the dialog box initially uses. The first filter in the buffer has index 1, the second 2, and so on. If the user changes the filter while using the dialog box, the nFilterIndex member is set to the index of the selected filter on return.

You can create a custom filter by setting the lpstrCustomFilter member to the address of a buffer that contains a single filter, and by setting the nMaxCustFilter member to the size of the buffer, in characters or bytes. The dialog box always places the custom filter at the beginning of the list of filters and, on return, always updates the pattern part of the filter with the pattern from the filter selected by the user.

For Explorer-style dialog boxes, the default extension may change if the user selects a different filter. If the user selects a filter whose first pattern is of the form *. xxx (that is, the extension does not include a wildcard character), the dialog box uses xxx as the default extension. This occurs only if you specified a default extension in the lpstrDefExt member of the OPENFILENAME structure. For example, if the user selects the "Source\0*.C;*.CXX\0" filter, the default extension changes to "C". However, if you had defined the filter as "Source\0*.C*\0", the default extension would not change because the extension includes a wildcard.

The CDN_INCLUDEITEM notification message provides another way to filter the names that the dialog box displays. To use this message, provide an OFNHookProc hook procedure and specify the OFN_ENABLEINCLUDENOTIFY flag in the OPENFILENAME structure when you create the dialog box. Each time the user opens a folder, the dialog box sends a CDN_INCLUDEITEM notification to your hook procedure for each item in the newly opened folder. The return value of the hook procedure indicates whether the dialog box should display the item in the folder's item list.

File and Directory Validation

Except as noted, the information in this section applies to both Explorer-style and old-style Open and Save As dialog boxes.

The dialog box automatically validates file names typed by the user to ensure that the names contain only valid characters. To override the file name character validation, set the OFN_NOVALIDATE flag.

To force the dialog box to verify that the user specified the name of an existing file, set the OFN_FILEMUSTEXIST flag. To force verification that the specified path exists, set the OFN_PATHMUSTEXIST flag. If you set the OFN_CREATEPROMPT flag, the dialog box prompts the user for permission to create a nonexistent file. If this flag is set and the user chooses to create a new file, the dialog box closes, and the function returns the specified name. Otherwise, the dialog box remains open.

When using the Save As dialog box, you can direct the dialog box to prompt the user for permission to overwrite an existing file by setting the OFN_OVERWRITEPROMPT flag.

By default, the dialog box creates a zero-length test file to determine whether a new file can be created in the selected directory. To prevent the creation of this test file, set the OFN_NOTESTFILECREATE flag.

If you enable a hook procedure, the dialog box notifies your hook procedure when a network sharing violation occurs for the file name specified by the user. If you set the OFN_EXPLORER flag, the dialog box sends the CDN_SHAREVIOLATION message to the hook procedure. If you do not set OFN_EXPLORER, the dialog box sends the SHAREVISTRING registered message to the hook procedure. To prevent the dialog box from sending any notifications for sharing violations, set the OFN_SHAREAWARE flag.

If the user selects the read-only check box, the dialog box sets the OFN_READONLY flag on return. To hide the Open As Read Only check box, set the OFN_HIDEREADONLY flag. To prevent the dialog box from returning names of existing files that have the read-only attribute, set the OFN_NOREADONLYRETURN flag.

To prevent the dialog box from dereferencing link files, set the OFN_NODEREFERENCELINKS value. In this case, the dialog box returns the name of the link file rather than the name of the file referenced by the link file.

Open and Save As Dialog Box Customization

You can customize an Open or Save As dialog box by providing a hook procedure, a custom template, or both. However, the Explorer-style and old-style versions of the dialog boxes differ in their use of custom templates and hook procedures.

For information about customizing an Explorer-style dialog box, see Explorer-Style Hook Procedures, Explorer-Style Custom Templates, and Explorer-Style Control Identifiers. For information about customizing an old-style dialog box, see Customizing Old-Style Dialog Boxes.

The following table summarizes the differences between the two styles.

Customization | Description
Explorer-style Hook procedure | The hook procedure receives notification messages sent from the common dialog box and messages for any additional controls that you defined by specifying a child dialog template. The hook procedure does not receive messages for the standard controls of the default dialog box.
Explorer-style Custom template | The system uses the custom template to create a child dialog box. The template can define additional controls, and can specify the location of the cluster of standard controls. The custom template does not replace the default template.
Old-style Hook procedure | The hook procedure receives all messages sent to the dialog box, including messages for the standard controls and any custom controls. The hook procedure also receives registered messages sent from the common dialog box.
Old-style Custom template | The custom template replaces the default template. Create the custom template by modifying the default template specified in the Fileopen.dlg file.

The default title for both Explorer-style and old-style dialog boxes is either " Open" or " Save As." To change the title, specify the new title in the lpstrTitle member of the OPENFILENAME structure.

Windows 2000/XP: A user's HKEY_CURRENT_USER ( HKCU) registry hive can contain values that customize the contents of the Explorer-style Open and Save As dialog boxes. These registry entries affect only the dialog boxes displayed for the user associated with the registry hive.

To hide features of Explorer-style Open and Save As dialog boxes, an administrator can set values under the following key.

HKCU\Software\Microsoft\Windows\CurrentVersion
    \Policies\Comdlg32
Value name | Value | Meaning
NoPlacesBar | 1 | Hides the places bar.
NoFileMRU | 1 | Hides the most-recently-used (MRU) list.
NoBackButton | 1 | Hides the back button.

The contents of the places bar are determined by the contents of the following key:

HKCU\Software\Microsoft\Windows\CurrentVersion
    \Policies\Comdlg32\Placesbar

Currently, there can only be five entries under this key, and the value-name index is zero based. The names for the entries should be Place0, Place1, Place2,Place3, and Place4. The values of the entries can be REG_DWORD, REG_SZ, and REG_EXPAND_SZ values that identify locations to include in the places bar.

Value type | Meaning
REG_DWORD | A CSIDL value that identifies a folder. For a list of CSIDL values, see the function.
REG_SZ or REG_EXPAND_SZ | A null-terminated string that specifies a valid path.

Explorer-Style Hook Procedures

You can customize an Explorer-style Open or Save As dialog box by providing a hook procedure, a custom template, or both. If you provide a hook procedure for an Explorer-style dialog box, the system creates a dialog box that is a child of the default dialog box. The hook procedure acts as the dialog procedure for the child dialog box. This child dialog box is based on the custom template, or on a default template if none is provided. For more information, see Explorer-Style Custom Templates.

To enable a hook procedure for an Explorer-style Open or Save As dialog box, use the OPENFILENAME structure when you create the dialog box. Set the OFN_ENABLEHOOK and OFN_EXPLORER flags in the Flags member and specify the address of an OFNHookProc hook procedure in the lpfnHook member. If you provide a hook procedure and omit the OFN_EXPLORER flag, you must use an OFNHookProcOldStyle hook procedure and you will get the old-style user-interface. For more information, see Customizing Old-Style Dialog Boxes.

An Explorer-style hook procedure receives a variety of messages while the dialog box is open. These include the following:

  • The WM_INITDIALOG message and other standard dialog box messages such as the WM_CTLCOLORDLG control color message.
  • A set of WM_NOTIFY notification messages indicating actions taken by the user or other dialog box events.
  • Messages for any additional controls that you defined by specifying a child dialog template.

In addition, there is a set of messages that you can send to an Explorer-style dialog box to get information or to control the behavior and appearance of the dialog box.

If you provide a hook procedure for an Explorer-style dialog box, the default dialog box procedure creates a child dialog box when the default dialog procedure is processing its WM_INITDIALOG message. The hook procedure acts as the dialog procedure for the child dialog box. At this time, the hook procedure receives its own WM_INITDIALOG message with the lParam parameter set to the address of the OPENFILENAME structure used to initialize the dialog box. After the child dialog finishes processing its own WM_INITDIALOG message, the default dialog procedure moves the standard controls, if necessary, to make room for any additional controls of the child dialog box. The default dialog procedure then sends the CDN_INITDONE notification message to the hook procedure.

The hook procedure receives WM_NOTIFY notification messages indicating actions taken by the user in the dialog box. You can use some of these messages to control the behavior of the dialog box. For example, the hook procedure receives the CDN_FILEOK message when the user chooses a file name and clicks the OK button. In response to this message, the hook procedure can use the SetWindowLong function to reject the selected name and force the dialog box to remain open.

The lParam parameter for each WM_NOTIFY message is a pointer to an OFNOTIFY or OFNOTIFYEX structure that defines the action. The code member in the header of this structure contains one of the following notification messages.

Message | Meaning
CDN_FILEOK | The user clicked the OK button; the dialog box is about to close.
CDN_FOLDERCHANGE | The user opened a new folder or directory.
CDN_HELP | The user clicked the Help button.
CDN_INCLUDEITEM | Determines whether an item should be displayed. When the user opens a new folder or directory, the system sends this notification for each item in the folder or directory. The system sends this notification only if the OFN_ENABLEINCLUDENOTIFY flag was set.
CDN_INITDONE | The system has finished initializing the dialog box, and the dialog box has finished processing the WM_INITDIALOG message. Also, the system has finished arranging controls in the common dialog box to make room for the controls of the child dialog box (if any).
CDN_SELCHANGE | The user selected a new file or folder from the file list.
CDN_SHAREVIOLATION | The common dialog box encountered a sharing violation on the file about to be returned.
CDN_TYPECHANGE | The user selected a new file type from the list of file types.

These WM_NOTIFY messages supersede the FILEOKSTRING , LBSELCHSTRING , SHAREVISTRING, and HELPMSGSTRING registered messages used by previous versions of the Open and Save As dialog boxes. However, the hook procedure also receives the superseded message after the WM_NOTIFY message if the WM_NOTIFY processing does not use SetWindowLong to set a nonzero DWL_MSGRESULT value.

To retrieve information about the status of the dialog box or to control the behavior and appearance of the dialog box, the hook procedure can send the following messages to the dialog box.

Message | Meaning
CDM_GETFILEPATH | Retrieves the path and file name of the selected file.
CDM_GETFOLDERIDLIST | Retrieves the item identifier list corresponding to the current folder that the dialog box has open. For more information about item identifier lists, see Item IDs .
CDM_GETFOLDERPATH | Retrieves the path of the current folder or directory for the dialog box.
CDM_GETSPEC | Retrieves the file name (not including the path) of the file currently selected in the dialog box.
CDM_HIDECONTROL | Hides the specified control.
CDM_SETCONTROLTEXT | Sets the text in the specified control.
CDM_SETDEFEXT | Sets the default file name extension for the dialog box.

Explorer-Style Custom Templates

To define additional controls for an Explorer-style Open or Save As dialog box, use the OPENFILENAME structure to specify a template for a child dialog box that contains the additional controls. If your child dialog template is a resource in an application or dynamic-link library, set the OFN_ENABLETEMPLATE flag in the Flags member and use the hInstance and lpTemplateName members of the structure to identify the module and resource name. If the template is already in memory, set the OFN_ENABLETEMPLATEHANDLE flag and use the hInstance member to identify the memory object that contains the template. When providing a child dialog template for an Explorer-style dialog box, you must also set the OFN_EXPLORER flag; otherwise, the system assumes you are providing a replacement template for an old-style dialog box. Typically, if you provide additional controls, you must also provide an Explorer-style hook procedure to process messages for the new controls.

You can create your child dialog box template as you do any other template, except that you must specify the WS_CHILD and WS_CLIPSIBLINGS styles and should specify the DS_3DLOOK and DS_CONTROL styles. The system requires the WS_CHILD style because your template defines a child dialog of the default Open or Save As dialog box. The WS_CLIPSIBLINGS style ensures that the child dialog box does not paint over any of the controls in the default dialog box. The DS_3DLOOK style makes sure that the appearance of the controls in the child dialog box is consistent with the controls in the default dialog box. The DS_CONTROL style makes sure that the user can use the TAB and other navigation keys to move between all controls, default or custom, in the customized dialog box.

To make room for the new controls, the system expands the default dialog box by the width and height of the custom dialog box. By default, all controls from the custom dialog box are positioned below the controls in the default dialog box. However, you can override this default positioning by including a static text control in your custom dialog box template and assigning it the control identifier value of stc32. (This value is defined in the DLG.H header file.) In this case, the system uses the control as the point of reference for determining where to position the new controls. All new controls above and to the left of the stc32 control are positioned the same amount above and to the left of the controls in the default dialog box. New controls below and to the right of the stc32 control are positioned below and to the right of the default controls. In general, each new control is positioned so that it has the same position relative to the default controls as it had to the stc32 control. To make room for these new controls, the system adds space to the left, right, bottom, and top of the default dialog box as needed.

The system requires the hook procedure to process all messages intended for the custom dialog box and therefore sends the same window messages to the hook procedure as to any other dialog box procedure. For example, the hook procedure receives WM_COMMAND messages when the user clicks on button controls in the custom dialog box. The hook procedure is responsible for initializing these controls and retrieving values from the controls when the dialog box is closed. Note that when the hook procedure receives the WM_INITDIALOG message, the system has not yet moved the controls to their final positions.

The default dialog box procedure handles messages for all the controls in the default dialog box, but the hook procedure receives the notification messages for user actions on these controls as described in Explorer-Style Hook Procedures.

Explorer-Style Control Identifiers

The Platform SDK provides the default dialog box template for the old-style dialog boxes, but does not include the default template for the Explorer-style dialog boxes. This is because the Explorer-style dialog boxes allow you to add your own controls but do not support modifying the template for the standard controls. However, in some cases, you may need to know the control identifiers used in the default templates. For example, the CDM_HIDECONTROL and CDM_SETCONTROLTEXT messages require a control identifier.

The following table shows the identifiers of the standard controls in the Explorer-style Open and Save As dialog boxes. The identifiers are constants defined in Dlgs.h and Winuser.h.

Control identifier | Control description
chx1 | The read-only check box
cmb1 | Drop-down combo box that displays the list of file type filters
stc2 | Label for the cmb1 combo box
cmb2 | Drop-down combo box that displays the current drive or folder, and that allows the user to select a drive or folder to open
stc4 | Label for the cmb2 combo box
cmb13 | Drop-down combo box that displays the name of the current file, allows the user to type the name of a file to open, and select a file that has been opened or saved recently. This is for earlier Explorer-compatible applications without hook or dialog template. Compare with edt1.
edt1 | Edit control that displays the name of the current file, or allows the user to type the name of the file to open. Compare with cmb13.
stc3 | Label for the cmb13 combo box and the edt1 edit control
lst1 | List box that displays the contents of the current drive or folder
stc1 | Label for the lst1 list box
IDOK | The OK command button (push button)
IDCANCEL | The Cancel command button (push button)
pshHelp | The Help command button (push button)

Customizing Old-Style Dialog Boxes

You can customize an old-style Open or Save As dialog box by providing an OFNHookProcOldStyle hook procedure that receives messages or notifications intended for the default dialog box procedure. You can also provide a custom template to use in place of the default template. The hook procedures and templates used with the old-style dialog boxes are similar to those used with the other common dialog boxes. For more information, see Hook Procedures for Common Dialog Boxes and Custom Templates .

To enable a hook procedure for an old-style Open or Save As dialog box, use the OPENFILENAME structure when you create the dialog box. Set the OFN_ENABLEHOOK flag in the Flags member and specify the address of an OFNHookProcOldStyle hook procedure in the lpfnHook member. The dialog box procedure sends a WM_INITDIALOG message to the hook procedure with the Param parameter set to the address of the OPENFILENAME structure used to initialize the dialog box.

You can use the OPENFILENAME structure to specify a custom template for the Open or Save As dialog box to use in place of the default template. If your custom template is a resource in an application or dynamic-link library, set the OFN_ENABLETEMPLATE flag in the Flags member and use the hInstance and lpTemplateName members of the structure to identify the module and resource name. If your custom template is already in memory, set the OFN_ENABLETEMPLATEHANDLE flag and use the hInstance member to identify the memory object that contains the template. Create the custom template by modifying the default template specified in the Fileopen.dlg file. The control identifiers used in the default Find and Replace dialog templates are defined in the Dlgs.h file.

By default, the GetOpenFileName and GetSaveFileName functions display the Explorer-style dialog boxes. If you want to display an old-style dialog box, you must provide an OFNHookProcOldStyle hook procedure and ensure that the OFN_EXPLORER flag is not set in the Flags member of the OPENFILENAME structure.

If you set the OFN_EXPLORER flag, the system treats a hook procedure or custom template as an Explorer-style customization. For information about customizing an Explorer-style dialog box, see Explorer-Style Custom Templates.

Example

This example describes sample code that displays an Open dialog box so a user can specify the drive, directory, and name of a file to open. The sample code first initializes an OPENFILENAME structure, and then calls the GetOpenFileName function to display the dialog box.

In this example, the lpstrFilter member is a pointer to a buffer that specifies two file name filters that the user can select to limit the file names that are displayed. The buffer contains a double-null terminated array of strings in which each pair of strings specifies a filter. The nFilterIndex member specifies that the first pattern is used when the dialog box is created.

This example sets the OFN_PATHMUSTEXIST and OFN_FILEMUSTEXIST flags in the Flags member. These flags cause the dialog box to verify, before returning, that the path and file name specified by the user actually exist.

The GetOpenFileName function returns TRUE if the user clicks the OK button and the specified path and file name exist. In this case, the buffer pointed to by the lpstrFile member contains the path and file name. The sample code uses this information in a call to the function to open the file.

Although this example does not set the OFN_EXPLORER flag, it still displays the default Explorer-style Open dialog box. However, if you want to provide a hook procedure or a custom template and you want the Explorer user interface, you must set the OFN_EXPLORER flag. Note, in the C programming language, a string enclosed in double quotes is null-terminated.

OPENFILENAME ofn;       // common dialog box structure
char szFile[260];       // buffer for file name
HWND hwnd;              // owner window
HANDLE hf;              // file handle

// Initialize OPENFILENAME
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;

// Display the Open dialog box.

if (GetOpenFileName(&ofn)==TRUE)
    hf = CreateFile(ofn.lpstrFile, GENERIC_READ,
        0, (LPSECURITY_ATTRIBUTES) NULL,
        OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
        (HANDLE) NULL);


Page Setup Dialog Box

The Page Setup dialog box lets the user set the following attributes of the printed page:

  • The paper type (envelope, legal, letter, and so on)
  • The paper source (manual feed, tractor feed, sheet feeder, and so on)
  • The page orientation (portrait or landscape)
  • The width of the page margins

The attributes presented in the dialog box vary, depending on the capabilities of the printer.

You create and display a Page Setup dialog box by initializing a PAGESETUPDLG structure and passing the structure to the PageSetupDlg function.

The following illustration shows a typical Page Setup dialog box.

If the user clicks the OK button, PageSetupDlg returns TRUE after setting various members in the PAGESETUPDLG structure to specify the user's selections. The ptPaperSize and rtMargin members contain the values specified by the user. The hDevMode and hDevNames members contain global memory handles for the DEVMODE and DEVNAMES structures. These structures contain additional page information as well as information about the printer. You can use this information to prepare the output to be sent to the selected printer.

If the user cancels the Page Setup dialog box or an error occurs, PageSetupDlg returns FALSE. To determine the cause of the error, call the CommDlgExtendedError function to retrieve the extended error value.

This section discusses the following topics.

  • Initializing the Page Setup Dialog Box
  • Customizing the Page Setup Dialog Box
  • Customizing the Sample Page
  • Example

Initializing the Page Setup Dialog Box

By default, the Page Setup dialog box displays information about the current default printer. To direct the dialog box to display information about a specific printer, set the members of a DEVMODE or DEVNAMES structure and assign the global memory handles of these structures to the corresponding member in PAGESETUPDLG. If you specify the name of a printer that is not currently installed, the dialog box displays an error message. To prevent the dialog box from displaying error messages, use the PSD_NOWARNING value. To retrieve information about the default printer without displaying the Page Setup dialog box, use the PSD_RETURNDEFAULT value.

If the default measurement system is inches, the dialog box uses thousandths of inches as the default unit of measurement. If the default measurement system is metric, the dialog box uses hundredths of millimeters as the default unit of measurement. To override the default unit of measurement, set the PSD_INHUNDREDTHSOFMILLIMETERS or PSD_INTHOUSANDTHSOFINCHES flag in the Flags member of the PAGESETUPDLG structure.

The initial values for the margins are one inch, by default. If you set the PSD_MARGINS flag, the dialog box displays the initial margin values specified in the rtMargin member. The default minimum values that the user can specify for the margins are the minimum margins allowed by the printer. If you set the PSD_MINMARGINS flag, the dialog box enforces the minimum margins specified in the rtMinMargin member.

To prevent users from selecting certain options, set any combination of the following flags to disable the corresponding controls.

Flag | Meaning
PSD_DISABLEMARGINS | Disables the edit controls in which the user enters the margin settings.
PSD_DISABLEORIENTATION | Disables the Portrait and Landscape radio buttons.
PSD_DISABLEPAPER | Disables the controls for selecting the paper size and paper source.
PSD_DISABLEPRINTER | Disables the Printer button.

Customizing the Page Setup Dialog Box

You can provide a custom template for the Page Setup dialog box, for example, if you want to include additional controls that are unique to your application. The PageSetupDlg function uses your custom template in place of the default template.

To provide a custom template for the Page Setup dialog box

  1. Create the custom template by modifying the default template specified in the Prnsetup.dlg file. The control identifiers used in the default Page Setup dialog template are defined in the Dlgs.h file.
  2. Use the PAGESETUPDLG structure to enable the template as follows:
      • If your custom template is a resource in an application or dynamic-link library, set the PSD_ENABLEPAGESETUPTEMPLATE flag in the Flags member. Use the hInstance and lpPageSetupTemplateName members of the structure to identify the module and resource name.

        -Or-

      • If your custom template is already in memory, set the PSD_ENABLEPAGESETUPTEMPLATEHANDLE flag. Use the hPageSetupTemplate member to identify the memory object that contains the template.

To filter messages sent to the dialog box procedure, you can provide a PageSetupHook hook procedure. If you use a custom template to define additional controls, you must provide a PageSetupHook hook procedure to process input for your controls. In addition, you can provide a PagePaintHook hook procedure to customize the contents of the sample page displayed by the Page Setup dialog box. For more information about the PagePaintHook hook procedure, see Customizing the Sample Page.

To enable a PageSetupHook hook procedure

  1. Set the PSD_ENABLEPAGESETUPHOOK flag in the Flags member of the PAGESETUPDLG structure.
  2. Specify the address of the hook procedure in the lpfnPageSetupHook member.

After processing its WM_INITDIALOG message, the dialog box procedure sends a WM_INITDIALOG message to the PageSetupHook hook procedure. The lParam parameter of this message is a pointer to the PAGESETUPDLG structure used to initialize the dialog box.

Customizing the Sample Page

The Page Setup dialog box includes an image of a sample page that shows how the user's selections affect the appearance of the printed output. The image consists of a rectangle that represents the selected paper or envelope type, with a dotted-line rectangle representing the current margins, and partial (Greek text) characters to show how text looks on the printed page.

When you call the PageSetupDlg function, you can provide a PagePaintHook hook procedure to customize the appearance of the sample page.

To enable a PagePaintHook hook procedure

  1. Set the PSD_ENABLEPAGEPAINTHOOK flag in the Flags member of the PAGESETUPDLG structure.
  2. Specify the address of the hook procedure in the lpfnPagePaintHook member.

Whenever the dialog box is about to draw the contents of the sample page, the hook procedure receives the following messages in the order in which they are listed.

Message | Meaning
WM_PSD_PAGESETUPDLG | The dialog box is about to draw the sample page. The hook procedure can use this message to prepare to draw the contents of the sample page.
WM_PSD_FULLPAGERECT | The dialog box is about to draw the sample page. This message specifies the bounding rectangle of the sample page.
WM_PSD_MINMARGINRECT | The dialog box is about to draw the sample page. This message specifies the margin rectangle.
WM_PSD_MARGINRECT | The dialog box is about to draw the margin rectangle.
WM_PSD_GREEKTEXTRECT | The dialog box is about to draw the Greek text inside the margin rectangle.
WM_PSD_ENVSTAMPRECT | The dialog box is about to draw in the envelope-stamp rectangle of an envelope sample page. This message is sent for envelopes only.
WM_PSD_YAFULLPAGERECT | The dialog box is about to draw the return address portion of an envelope sample page. This message is sent for envelopes and other paper sizes.

If the hook procedure returns TRUE for any of the first three messages of a drawing sequence (WM_PSD_PAGESETUPDLG, WM_PSD_FULLPAGERECT, or WM_PSD_MINMARGINRECT) the dialog box sends no more messages and does not draw in the sample page until the next time the system needs to redraw the sample page. If the hook procedure returns FALSE for all three messages, the dialog box sends the remaining messages of the drawing sequence.

If the hook procedure returns TRUE for any of the remaining messages in a drawing sequence, the dialog box does not draw the corresponding portion of the sample page. If the hook procedure returns FALSE for any of these messages, the dialog box draws that portion of the sample page.

To prevent the dialog box from drawing the contents of the sample page, you can set the PSD_DISABLEPAGEPAINTING flag. This flag does not affect your PagePaintHook hook procedure, which still receives all the WM_PSD_* messages and can draw the sample page contents.

Example

This example describes sample code that displays a Page Setup dialog box so a user can select the attributes of the printed page, such as the paper type, paper source, page orientation, and page margins. The sample code first initializes a PAGESETUPDLG structure, and then calls the PageSetupDlg function to display the dialog box.

This example sets the PSD_MARGINS flag in the Flags member and uses the rtMargin member to specify the initial margin values. It sets the PSD_INTHOUSANDTHSOFINCHES flag to ensure that the dialog box expresses margin dimensions in thousandths of an inch.

On input, the sample code sets the hDevMode and hDevNames members to NULL. If the function returns TRUE, the function uses these members to return handles to and DEVNAMES structures containing the user's input and information about the printer. You can use this information to prepare the output to be sent to the selected printer.

The example also enables a PagePaintHook hook procedure to customize drawing of the contents of the sample page.

PAGESETUPDLG psd;    // common dialog box structure
HWND hwnd;           // owner window

// Initialize PAGESETUPDLG
ZeroMemory(&psd, sizeof(psd));
psd.lStructSize = sizeof(psd);
psd.hwndOwner   = hwnd;
psd.hDevMode    = NULL; // Don't forget to free or store hDevMode
psd.hDevNames   = NULL; // Don't forget to free or store hDevNames
psd.Flags       = PSD_INTHOUSANDTHSOFINCHES | PSD_MARGINS |
                  PSD_ENABLEPAGEPAINTHOOK;
psd.rtMargin.top = 1000;
psd.rtMargin.left = 1250;
psd.rtMargin.right = 1250;
psd.rtMargin.bottom = 1000;
psd.lpfnPagePaintHook = PaintHook;

if (PageSetupDlg(&psd)==TRUE) {
    // check paper size and margin values here
}


Print Dialog Box

The Print dialog box lets the user select options for a particular print job. For example, the user can specify the printer to use, the range of pages to print, and the number of copies.

Windows 2000/XP: You can use the PrintDlgEx function to display a Print Property Sheet , which has a General page containing controls similar to the Print dialog box. The property sheet can also have additional application-specific and driver-specific property pages following the General page.

You create and display a Print dialog box by initializing a PRINTDLG structure and passing the structure to the PrintDlg function.

The following illustration shows a typical Print dialog box.

If the user clicks the OK button, PrintDlg returns TRUE and uses the PRINTDLG structure to return information about the user's selections. For example, the hDevMode and hDevNames members typically return global memory handles for and DEVNAMES structures. You can use the information in these structures to create a device context or an information context for the selected printer.

If the user cancels the Print dialog box or an error occurs, PrintDlg returns FALSE. You can determine the cause of an error by using the CommDlgExtendedError function to retrieve the extended error value.

The Print dialog box includes a Print Range group of radio buttons that indicate whether the user wants to print all pages, a range of pages, or only the selected text. Before calling PrintDlg, you can set one of the PD_ALLPAGES, PD_SELECTION, or PD_PAGENUMS flags to indicate which button is initially selected. When PrintDlg returns TRUE, the function sets one of these flags to indicate the user's selections. If PD_PAGENUMS is set, the nFromPage and nToPage members of the PRINTDLG structure contain the starting and ending pages specified by the user. To disable the Pages radio button and its associated From and To edit controls, set the PD_NOPAGENUMS flag. To disable the Selection radio button, set the PD_NOSELECTION flag.

The dialog box includes an edit control in which the user can type the number of copies to print. If the hDevMode member of the PRINTDLG structure is non-NULL, the dmCopies member of the structure specifies the initial value for this edit control. If hDevMode is NULL, the nCopies member of the PRINTDLG structure specifies the initial value. When PrintDlg returns, nCopies typically indicates the number of copies specified by the user. However, if you set the PD_USEDEVMODECOPIESANDCOLLATE flag when you create the dialog box, nCopies is always set to 1 on return and the dmCopies member of DEVMODE indicates the number of copies to print.

The Collate check box indicates whether the user wants to collate the pages if multiple copies are being printed. The PD_COLLATE flag is set if the Collate check box is selected. If your application does not support multiple copies or simulated collation, set the PD_USEDEVMODECOPIESANDCOLLATE flag in the Flags member of the PRINTDLG structure. This disables the Collate check box and the Number of Copies edit control unless the printer driver supports multiple copies and collation.

The Print To File check box indicates whether the user wants to send output to a file rather than to a printer. You can set the PD_PRINTTOFILE flag so the check box is initially selected. To hide the check box, set the PD_HIDEPRINTTOFILE flag. To disable it, set the PD_DISABLEPRINTTOFILE flag. If the user selects the Print To File option, PrintDlg sets the PD_PRINTTOFILE flag and returns "FILE:" at the offset indicated by the wOutputOffset member of the DEVNAMES structure. When you call the function to start the printing operation, specify this "FILE:" string in the lpszOutput member of the structure. Specifying this string causes the print subsystem to query the user for the name of the output file.

By default, the Print dialog box initially displays information about the current default printer. To display information for another installed printer, initialize a and a DEVNAMES structure and assign the global memory handle for the structure to the hDevMode and hDevNames members. The device name you specify in the dmDeviceName member of the DEVMODE structure and in the wDriverOffset member of the DEVNAMES structure must identify a printer device that is also listed in the [Devices] section of the Win.ini file. If the device is not listed, PrintDlg returns an error.

You can direct PrintDlg to create a device context or information context for the printer by setting the PD_RETURNDC or PD_RETURNIC flag in the Flags member of the PRINTDLG structure. The function returns a handle to the device context or information context in the hDC member. If you use the PD_RETURNDC flag, you can use the device context to generate output for the printer.

To retrieve information about the default printer without displaying the Print dialog box, set the PD_RETURNDEFAULT flag. In this case, PrintDlg returns immediately after setting the hDevMode and hDevNames members to handles for structures containing the information.

By default, PrintDlg displays message boxes when errors occur. For example, the function displays an error message if no printers are installed. To prevent the function from displaying these warning messages, set the PD_NOWARNING flag.

The following topics are discussed in this section.

  • Customizing the Print Dialog Box
  • Print Setup Dialog Box
  • Example

Customizing the Print Dialog Box

You can provide a custom template for the Print dialog box, for example, if you want to include additional controls that are unique to your application. The PrintDlg function uses your custom template in place of the default template.

To provide a custom template for the Print dialog box:

  1. Create the custom template by modifying the default template specified in the Prnsetup.dlg file. The control identifiers used in the default Print dialog template are defined in the Dlgs.h file.
  2. Use the PRINTDLG structure to enable the template as follows:
    • If your custom template is a resource in an application or dynamic-link library, set the PD_ENABLEPRINTTEMPLATE flag in the Flags member. Use the hInstance and lpPrintTemplateName members of the structure to identify the module and resource name.

      -Or-

    • If your custom template is already in memory, set the PD_ENABLEPRINTTEMPLATEHANDLE flag. Use the hPrintTemplate member to identify the memory object that contains the template.

You can provide a PrintHookProc hook procedure for the Print dialog box. The hook procedure can process messages sent to the dialog box. It can also send messages to the dialog box. If you use a custom template to define additional controls, you must provide a hook procedure to process input for your controls.

To enable a hook procedure for the Print dialog box:

  1. Set the PD_ENABLEPRINTHOOK flag in the Flags member of the PRINTDLG structure.
  2. Specify the address of the hook procedure in the lpfnPrintHook member.

After processing its WM_INITDIALOG message, the dialog box procedure sends a WM_INITDIALOG message to the hook procedure. The lParam parameter of this message is a pointer to the PRINTDLG structure used to initialize the dialog box.

Print Setup Dialog Box

You can create and display a Print Setup dialog box by setting the PD_PRINTSETUP flag in a call to the PrintDlg function. However, the Print Setup dialog box has been superseded by the Page Setup dialog box and should not be used in new applications.

The following flags apply only to the Print Setup dialog box:

  • PD_ENABLESETUPHOOK
  • PD_ENABLESETUPTEMPLATE
  • PD_ENABLESETUPTEMPLATEHANDLE

Example

This example describes sample code that displays a Print dialog box so a user can select options for printing a document. The sample code first initializes a PRINTDLG structure, and then calls the PrintDlg function to display the dialog box.

This example sets the PD_RETURNDC flag in the Flags member of the PRINTDLG structure. This causes PrintDlg to return a device context handle for the selected printer in the hDC member. You can use the handle to render output on the printer.

On input, the sample code sets the hDevMode and hDevNames members to NULL. If the function returns TRUE, these members return handles to and DEVNAMES structures containing the user's input and information about the printer. You can use this information to prepare the output to be sent to the selected printer.

#include <windows.h>
// This program will call the print dialog and print "OK" or "Cancel" depending on which button the user pressed.
PRINTDLG pd;
HWND hwnd;
int main(void)
{
    // Initialize PRINTDLG
    memset(&pd,0, sizeof(pd));
    pd.lStructSize = sizeof(pd);
    pd.hwndOwner   = hwnd;
    pd.hDevMode    = NULL;     // Don't forget to free or store hDevMode
    pd.hDevNames   = NULL;     // Don't forget to free or store hDevNames
    pd.Flags       = PD_USEDEVMODECOPIESANDCOLLATE | PD_RETURNDC;
    pd.nCopies     = 1;
    pd.nFromPage   = 0xFFFF;
    pd.nToPage     = 0xFFFF;
    pd.nMinPage    = 1;
    pd.nMaxPage    = 0xFFFF;

    if (PrintDlg(&pd)==TRUE)
    {
        // GDI calls to render output.
        printf("OK\n");

        // Delete DC when done.
        DeleteDC(pd.hDC);
    }
    else printf("Cancel.\n");
    return 0;
}

Compile with "lc prtdlg.c".


The resource editor

This tool allows you to edit visually a dialog box or another resource. Its user interface is described in this documentation. Below is a schematic of the main display.


Adding a dialog box

To create a new dialog box select the "Objects" menu and then "New dialog".

This will create an empty dialog box. A new window appears at the right side, the properties window.

The contents of this window can change, according to what object is selected. When you create a dialog box, it is automatically selected, and the properties window displays the associated information.

Each object will be referenced in your program by a numeric identifier, in this case 21600. The dialog editor chooses a number according to which dialog identifiers are already used. You can change this number but is better to leave the defaults since you could create problems with other identifiers.

To avoid using a bare number, each identifier will be provided a corresponding #define instruction to give it a symbolic name or "Symbol" for short. In this case the editor will write in the header file a line like this:

#define DLG_21600    21600

You can (and should) change the default symbol name to something like INPUT_DIALOG or DID_INPUT. The names are case sensitive, and following an established C tradition the names are in upper case since they are macros. This is not mandatory but it is useful for avoiding conflicts with other identifiers in your program.

Note that the properties window is a modal window. You can't do anything else when it is open. To return to the editor you should close that window.


Adding controls to the dialog

The list of the controls appears when you press the [image] symbol at the left of the horizontal toolbar.

To add a control to the dialog box you click once in the control you want to add, then you move the mouse to the position in the dialog box where you want it to appear.

You will notice that the cursor changes its shape when you it enters the dialog box, indicating you (roughly) the dimensions of the new control.

You click once at the point where you want the new control to be shown. It is not very important to be really accurate since you can move it later.

You can change the most important properties of a control (its symbolic name and its asociated text) by entering directly those parameters in the controls at the top of the editor. To enter the name you use the control at the top left, to enter the text you use the edit control in the middle.

Note that the coordinates of the new control appear in the status bar at the bottom of the editor.

To add another control, just select (with one click) another in the list. Note that the controls window can be dettached and made floating by selecting the "Keep open" option at the bottom.

To revert to normal operation (control window hidden) just close it.


Managing the selection

At any time there is always a selected control, the one you are working with. It is distinguished by eight red rectangles that allow you to resize it in all directions.

The selection can be more than just one control. This is useful for aligning a set of controls. Suppose this situation:

Here, we have one control selected. To align the three text fields, you click in a second control (in this case "Text2") holding pressed the SHIFT key. This indicates the editor that you do not want to select a new object but to extend the selection to include both objects. You will see a display similar to this:

The second (most recently selected control) has 8 full red handles, and the other has 8 empty handles, meaning it is seleted, but no longuer the "dominant" control.

To align the two controls you just press the alignment buttons at the top of the editor. For instance if you want the editor to align the controls using the left margin you press the button [image] that as avertical bar at the left side. This will produce a display like this:

Note that the editor moved the "Text3" control to the position of the dominant control "Text2", that has the full red handles. This is a general principle that applies to selections of several controls, not only two.

When you have several controls selected, clicking in a selected control and holding the SHIFT key will deselect the control. You can change the dominant control by clicking on any of the selected controls (without any SHIFT key).

Note that the coordinates shown in the status bar are the coordinates of the whole selection.


Moving and nailing down objects

You can move the selection by pressing the left mouse button down somewhere in the middle of it and holding the button pressed for a certain time (less that a second). This will change the form of the mouse to a hand. You can then move the selection by moving the mouse.

When the mouse is not precise enough, you can finely move the controls one unit at a time using the arrows in the keyboard.

You can fix an object in one or two directions by using the [image] tool. You click in that tool, then you click in one of the 8 handles. The control will be fixed in the line that intersects that handle. This is useful for avoiding moving controls by chance.

A fixed control handle changes its color to blue.

The button can only move horizontally now;


Editing the symbol table

You can modify any symbol or its numeric value with the "Design", then "Symbols" menu option. In the dialog box that appears after selecting this option you can change the numeric value or the name.

You modify the values "Symbol" and "Value" in the corresponding edit fields, then select the button "Add" or "Change", or "Erase" if you want to get rid of a symbol.


Group order

The group and the tab order are essential for a good user interface. The tab order is the sequence that the focus of the controls in the dialog will follow when the user presses the TAB key. Normally, the TAB key should go from one control to its immediate neighbor, without jumping around.

The dialog editor will establish this sequence as just the order that you used to drop the controls in the dialog. It often happens, however, that you drop a control, and then you realize that you forgot one, and drop another control in a wholly unrelated place. This doesn’t affect your dialog box visually, but it does affect the user interface. Pressing the TAB key will make the focus jump around within the controls of your dialog box.

Besides, it is important, that static controls like group boxes or text fields aren’t available with the TAB key. If they acquire the focus, they do not show it, so the user doesn’t know where the focus is.

You can change the tab order by moving the controls around within this dialog box. To move a control you select it first, by clicking in the middle of a row.

When a control is selected, you will see that the form of the mouse changes to an horizontal bar when moving within the list of controls. This means that you can drop the control in that position, and change its order.

The controls that are reachable with the TAB key have a small tab symbol at the left of them.

You should remove that tab stop from Group boxes, static text fields, and other static controls. You should add it to all controls that receive user input like buttons, edit fields, list boxes, etc.

You can set/unset this property with the corresponding buttons at the right side of the controls list.

You can set the ‘GROUP’ property to any control, that will become a group separator for a number of controls that are logically related.


The output of the editor

The edited resources are written into several files:

  1. The header file where the #defines of the symbolic names are written that is included in your source code to name objects symbolically.

  2. The binary resource file that can be used by the linker to bind the resource into the executable.

  3. You can also generate an ASCII rc file that can be later compiled to a binary resoure file.

  4. You may wish to generate a .dlg file with just the dialog box definitions and not any other resources.

You can configure this options using the menu "Design", then "Output".


General properties of controls

For each control, the editor shows in the properties window several fields that are consistently maintained for all controls.

The "Symbol" field allows you to modify the symbolic name of the control.

The "Symbol value field allows you to change the numeric id.

The "Position" field can be used to place a control at some exact coordinates.

"Tab stop" means whether the control will be visited when the user presses the tab key.


Buttons

A button is a control the user can click to provide input to an application. usually the input is a command action.

A push button is a rectangle containing application-defined text (label), an icon, or a bitmap that indicates what the button does when the user selects it. A push button can be one of two styles: standard or default, as defined by the constants BS_PUSHBUTTON and BS_DEFPUSHBUTTON. A standard push button is typically used to start an operation. It receives the keyboard focus when the user clicks it. A default push button, on the other hand, is typically used to indicate the most common or default choice. It is a button that the user can select by simply pressing ENTER when a dialog box has the input focus.

When the user clicks a push button (of either style), it receives the keyboard focus. The system sends the button's parent window a WM_COMMAND message that contains the BN_CLICKED notification code. In response, the dialog box typically closes and carries out the operation indicated by the button.

For more information about buttons please see their reference.

Styles

Buttons have several styles. The type can be either standard or "Default". When a "Default" type of button is choosen, the dialog box will be closed when the user clicks on that button. This is generally the style used for the "Ok" button.

A button can be "owner draw" too, meaning that you draw the button with your own drawing functions. Windows defines an interface with several messages that you should catch to draw the button.

Functions provided for buttons within the generated framework

HANDLE GetImage(int type)

HANDLE SetImage(int type,HANDLE image)

Retrieves the handle of the image associated with the button (bitmap or icon). The parameter should either IMAGE_BITMAP or IMAGE_ICON. Other values will provoke an undefined result.

Example:

ST_BUTTON *button;

...

HANDLE h = button->GetImage(IMAGE_BITMAP);

HANDLE GetBitmap(void )

HANDLE SetBitmap(HANDLE image )

Retrieves the handle of the bitmap associated with the button (bitmap or icon).

Example:

ST_BUTTON *button;

...

HANDLE h = button->GetBitmap();

int GetState(void)

int SetState(int state)

The return value of GetState specifies the current state of the button. You can use the following values to extract information about the state. For a full description see the button state values table.

The argument of SetState must be one of the values in the table of button state values.

Example:

ST_BUTTON *button;

...

HANDLE h = button->GetClick();

void Click(void)

This will simulate a click on the button.

Example:

ST_BUTTON *button;

...

HANDLE h = button->Click();


Check boxes

A check box consists of a square box and application-defined text (label), an icon, or a bitmap, that indicates a choice the user can make by selecting the button. Applications typically display check boxes in a group box to permit the user to choose from a set of related, but independent options. For example, an application might present a group of check boxes from which the user can select error conditions that produce warning beeps.

A check box can be one of four styles: standard, automatic, three-state, and automatic three-state, as defined by the constants BS_CHECKBOX, BS_AUTOCHECKBOX, BS_3STATE, and BS_AUTO3STATE, respectively. Each style can assume two check states: checked (a check mark inside the box) or cleared (no check mark). In addition, a three-state check box can assume an indeterminate state (a grayed box inside the check box). Repeatedly clicking a standard or automatic check box toggles it from checked to cleared and back again. Repeatedly clicking a three-state check box toggles it from checked to cleared to indeterminate and back again.

When the user clicks a check box (of any style), the check box receives the keyboard focus. The system sends the check box's parent window a WM_COMMAND message containing the BN_CLICKED notification code. The parent window doesn't acknowledge this message if it comes from an automatic check box or automatic three-state check box, because the system automatically sets the check state for those styles. But the parent window must acknowledge the message if it comes from a check box or three-state check box because the parent window is responsible for setting the check state for those styles. Regardless of the check box style, the system automatically repaints the check box once its state is changed.

Styles:

  • Normal check boxes look like this:
  • Flat. Produces checkboxes with this appearence:
  • Push like. Produces checkboxes like a push button:
  • Other styles can be applied to this control (static edge, Modal frame, etc) .

Type:

  • Auto: This type of check boxes toggles automatically when the user activates it, without requiring from the programmer any intervention.
  • Three state. This check boxes can be in a checked, unchecked, or greyed state. The other types of listboxes can be only in either checked or unchecked state.


Combo boxes

A combo box consists of a list and a selection field. The list presents the options that a user can select and the selection field displays the current selection. Except in drop-down list boxes, the selection field is an edit control and can be used to enter text not available in the list.

Combo boxes can be characterized by type and style. Combo box types determine whether the combo box list is a drop-down list and whether the selection field is an edit control. A drop-down list appears only when the user opens it, so it uses less screen space than a list that is always visible. If the selection field is an edit control, the user can enter information not available in the list; otherwise, the user can only select items in the list.

The following table shows the three combo box types and indicates their drop-down list and edit control attributes.

Combo box type | Drop-down list | Edit control
Drop-down combo box | Yes | Yes
Drop-down list box | Yes | No
Simple combo box | No | Yes

Combo box styles define specific properties of a combo box. You can combine styles; however some styles only apply to certain combo box types.

Styles

  • No height adjust.Specifies that the size of the combo box is exactly the size specified by the application when it created the combo box. Normally, the system sizes a combo box so that it does not display partial items.
  • Local memory. Specifies that an owner-drawn combo box contains items consisting of strings. The combo box maintains the memory and address for the strings so the application can use the CB_GETLBTEXT message to retrieve the text for a particular item.
  • DOS char convertion.Converts text entered in the combo box edit control from the Windows character set to the OEM character set and then back to the Windows character set. This ensures proper character conversion when the application calls the CharToOem function to convert a Windows string in the combo box to OEM characters. This style is most useful for combo boxes that contain file names and applies only to combo boxes created with the CBS_SIMPLE or CBS_DROPDOWN style.
  • Owner draw fixed.Specifies that the owner of the list box is responsible for drawing its contents and that the items in the list box are all the same height. The owner window receives a WM_MEASUREITEM message when the combo box is created and a WM_DRAWITEM message when a visual aspect of the combo box has changed.
  • Owner draw variable.Specifies that the owner of the list box is responsible for drawing its contents and that the items in the list box are variable in height. The owner window receives a WM_MEASUREITEM message for each item in the combo box when you create the combo box and a WM_DRAWITEM message when a visual aspect of the combo box has changed.
  • Auto hscroll. Automatically scrolls the text in an edit control to the right when the user types a character at the end of the line. If this style is not set, only text that fits within the rectangular boundary is allowed.


Dialog box properties

Button

Style

Effect

Tool window

WS_EX_TOOLWINDOW

A tool window has a title bar that is shorter than a normal title bar, and the window title is drawn using a smaller font. A tool window does not appear in the task bar or in the window that appears when the user presses ALT+TAB.

Accept files

WS_EX_ACCEPTFILES

Specifies that a window created with this style accepts drag-and-drop files.

Clip siblings

WS_CLIPSIBLINGS

Clips child windows relative to each other ; that is, when a particular child window receives a paint message, the WS_CLIPSIBLINGS style clips all other overlapped child windows out of the region of the child window to be updated. (If WS_CLIPSIBLINGS is not given and child windows overlap, when you draw within the client area of a child window, it is possible to draw within the client area of a neighboring child window.) For use with the WS_CHILD style only.

Transparent

WS_EX_TRANSPARENT

Specifies that a window created with this style is to be transparent. That is, any windows that are beneath the window are not obscured by the window. A window created with this style receives WM_PAINT messages only after all sibling windows beneath it have been updated.

Center mouse

DS_CENTERMOUSE

Centers the mouse cursor in the dialog box.

Set foreground

DS_SETFOREGROUND

This style brings the dialog box to the foreground. Internally, Windows calls the SetForegroundWindow function for the dialog box.

Control

DS_CONTROL

Creates a dialog box that works well as a child window of another dialog box, much like a page in a property sheet. This style allows the user to tab among the control windows of a child dialog box, use its accelerator keys, and so on.

Absolute alignment

DS_ABSALIGN

Indicates that the coordinates of the dialog box are screen coordinates ; otherwise, Windows assumes they are client coordinates.

No idle msg.

DS_NOIDLEMSG

Suppresses WM_ENTERIDLE messages that Windows would otherwise send to the owner of the dialog box while the dialog box is displayed.

System modal

DS_SYSMODAL

Creates a system-modal dialog box. This style causes the dialog box to have the WS_EX_TOPMOST style, but otherwise has no effect on the dialog box or the behavior of other windows in the system when the dialog box is displayed.

Popup

WS_POPUP

Creates a dialog that has the WS_POPUP bit on. Normally this is the default.

Child

WS_CHILD

Creates a dialog that has the WS_CHILD window style. Normally this is not desired. The dialog box can’t leave the boundaries of its mother window.

No fail create

DS_NOFAILCREATE

Creates the dialog box even if errors occur ¾ for example, if a child window cannot be created or if the system cannot create a special data segment for an edit control.

Clip children

WS_CLIPCHILDREN

Avoids drawing in child windows

Local edit

DS_LOCALEDIT

Applies to 16-bit applications only. This style directs edit controls in the dialog box to allocate memory from the application’s data segment. Otherwise, edit controls allocate storage from a global memory object. Somehow this button has resisted the port from 16 bit weditres...

3D look

DS_3DLOOK

This style is required only by Win32-based applications compiled for versions of Windows earlier than Windows 95 or Windows NT 4.0. The system automatically applies the three-dimensional look to dialog boxes created by applications compiled for current versions of Windows.

Center

DS_CENTER

Centers the dialog box in the working area ; that is, the area not obscured by the tray.

Visible

WS_VISIBLE

Show the dialog when it starts

Context help

DS_CONTEXTHELP

Includes a question mark in the title bar of the dialog box. When the user clicks the question mark, the cursor changes to a question mark with a pointer. If the user then clicks a control in the dialog box, the control receives a WM_HELP message. The control should pass the message to the dialog procedure, which should call the WinHelp function using the HELP_WM_HELP command. The Help application displays a pop-up window that typically contains help for the control.Note that DS_CONTEXTHELP is just a placeholder. When the dialog box is created, the system checks for DS_CONTEXTHELP and, if it is there, adds WS_EX_CONTEXTHELP to the extended style of the dialog box. WS_EX_CONTEXTHELP cannot be used with the WS_MAXIMIZEBOX or WS_MINIMIZEBOX styles.

Disabled

WS_DISABLED

Creates a window that is disabled at startup.

Optional Gadgets

Button | Style | Effect
Title | WS_CAPTION | Shows a dialog box title
Min button | WS_MINIMIZE | Minimize control in titlebar
Max button | WS_MAXIMIZE | Maximize button in titlebar
System menu | WS_SYSMENU | System menu
Vertical/horizontal scroll | WS_HSCROLL/WS_VSCROLL | Scroll bars. Normally never used

Standard buttons

This allows you to add the standard button ‘OK’, ‘Cancel’, and ‘Help’ to the dialog box automatically.

Just press the ones you want to be added.


Edit fields

An edit control is a rectangular control window typically used in a dialog box to permit the user to enter and edit text by typing on the keyboard.

Edit controls support both the Unicode character set in which characters are two bytes, and ANSI character sets in which characters are one byte.

Edit Control Features

An edit control is selected and receives the input focus when a user clicks the mouse inside it or presses the TAB key. After it is selected, the edit control displays its text (if any) and a flashing caret that indicates the insertion point. The user can then enter text, move the insertion point, or select text to be edited by using the keyboard or the mouse. An edit control can send notification messages to its parent window in the form of WM_COMMAND messages. A parent window can send messages to an edit control in a dialog box by calling the SendDlgItemMessage function.

A combo box is a control that combines much of the functionality of an edit control and a list box. In a combo box, the edit control displays the current selection and the list box presents options a user can select. For more information about combo boxes, see Combo Boxes .

Styles

  1. Border: Wether it has a black line for a border or not.
  2. Uppercase: Whether it should convert all input to uppercase or not
  3. Lowercase: Similar to above.
  4. Password: Controls with this style do not show what the user types, just an asterisk.
  5. Visible selection means whether the control will retain its selection even if it looses the focus. Normally, edit controls do not show the selection when they do not have the focus;
  6. Horz/Vert scroll. Not very useful unless the edit field is multiline.
  7. Want carriage return: Whether the return key is processed by the control or passed to the dialog procedure.
  8. Translate PCchar set. Useful only if you have old DOS software with other code page in it.
  9. Multi-line: Whether the control can hold several lines.
  10. Number means that the control will only accept characters between 0 and 9. No minus sign is allowed, nor floating point notation.
  11. Read only means that the user can only see the data displayed but not change it.
  12. Automatic scroll means that the control will display a sliding window when the data is greater than the screen dimensions of the control.
  13. Text alignment: Either left to right (default) or right to left (oriental languages).

The Text Buffer

The system stores edit control text in a buffer and copies it to the control, as necessary.

Allocating a Text Buffer

When the system creates an edit control, it automatically creates a text buffer, sets its initial size, and increases the size as necessary. The size can be up to a predefined limit of approximately 32 kilobyte (KB) for single-line edit controls. Because this limit can change, it is called a soft limit. An application can set a hard limit to the buffer size by sending an EM_SETLIMITTEXT message to the edit control. If the buffer exceeds either limit, the system sends the application an EN_ERRSPACE message. An application can retrieve the current text limit by sending an EM_GETLIMITTEXT message.

The system typically creates an edit control buffer in a dialog box, using memory outside the application's data segment. An application can suppress this default allocation behavior and create the buffer from its local heap by using the DS_LOCALEDIT style (see "Dialog Box Template Styles" in About Dialog Boxes ) when creating the edit control. An application that uses the DS_LOCALEDIT style is responsible for all buffer allocations. To make the initial allocation, an application can call the LocalAlloc function and pass the returned buffer handle to the edit control by sending it an EM_SETHANDLE message. To make subsequent allocations (in response to an EN_ERRSPACE message, for example), an application should save the current buffer content (if necessary) and obtain a new buffer as follows.

To save the current buffer and obtain a new one:

  1. Retrieve the handle of the memory currently allocated for the text in a multiline edit control by sending the control an EM_GETHANDLE message.
  2. Free the buffer by calling the LocalFree function.
  3. Obtain a new buffer (and buffer handle) by calling LocalAlloc.
  4. Give the buffer handle to the system by sending the control an EM_SETHANDLE message.

The EM_SETHANDLE and EM_GETHANDLE messages apply only to multiline edit controls.

An application that uses the default allocation behavior (that is, does not use the DS_LOCALEDIT style (see "Dialog Box Template Styles" in About Dialog Boxes)) must not send EM_SETHANDLE and EM_GETHANDLE messages to the edit control.

Sending an EM_SETHANDLE message has several side effects: it clears the undo flag (making the EM_CANUNDO message return zero), it clears the modify flag (making the EM_GETMODIFY message return zero), and it redraws the edit control window.

Initializing a Text Buffer

An application can initialize or reinitialize an edit control's text buffer by calling the SetDlgItemText function. An application can retrieve the content of a text buffer by calling the GetDlgItemText function.

Making a Text Buffer Readonly

For each edit control, the system maintains a read-only flag that indicates whether the control's text is read-write (the default) or read-only. An application can set the read-write flag or the read-only flag for the text by sending the control an EM_SETREADONLY message. To determine whether an edit control is read-only, an application can call the GetWindowLong function using the GWL_STYLE constant. The EM_SETREADONLY message applies to both single-line and multiline edit controls.

Changing the Formatting Rectangle

The visibility of an edit control's text is governed by the dimensions of its window rectangle and its formatting rectangle. The window rectangle is the client area of the window containing the edit control. The formatting rectangle is a construct maintained by the system for formatting the text displayed in the window rectangle. When an edit control is first displayed, the two rectangles are identical on the screen. An application can make the formatting rectangle larger than the window rectangle (thereby limiting the visibility of the edit control's text) or smaller than the window rectangle (thereby creating extra white space around the text).

An application can set the coordinates of an edit control's formatting rectangle by sending it an EM_SETRECT message. The EM_SETRECT message also automatically redraws the edit control's text. To establish the coordinates of the formatting rectangle without redrawing the control's text, an application can send the control an EM_SETRECTNP message. To retrieve the coordinates of the formatting rectangle, an application can send the control an EM_GETRECT message. These messages apply to multiline edit controls only.

Edit Control Notification Messages

The user makes editing requests by using the keyboard and mouse. The system sends each request to the edit control's parent window in the form of a WM_COMMAND message. The message includes the edit control identifier in the low-order word of the wParam parameter, the handle of the edit control in the lParam parameter, and an edit control notification message corresponding to the user's action in the high-order word of the wParam parameter.

An application should examine each notification message and respond appropriately. The following table lists each edit control notification message and the action that generates it.

Notification message | User action
EN_CHANGE | The user has modified text in an edit control. The system updates the display before sending this message (unlike EN_UPDATE ).
EN_ERRSPACE | The edit control cannot allocate enough memory to meet a specific request.
EN_HSCROLL | The user has clicked the edit control's horizontal scroll bar. The system sends this message before updating the screen.
EN_KILLFOCUS | The user has selected another control.
EN_MAXTEXT | While inserting text, the user has exceeded the specified number of characters for the edit control. Insertion has been truncated. This message is also sent either when an edit control does not have the ES_AUTOHSCROLL style and the number of characters to be inserted exceeds the width of the edit control or when an edit control does not have the ES_AUTOVSCROLL style and the total number of lines to be inserted exceeds the height of the edit control.
EN_SETFOCUS | The user has selected this edit control.
EN_UPDATE | The user has altered the text in the edit control and the system is about to display the new text. The system sends this message after formatting the text, but before displaying it, so that the application can resize the edit control window.
EN_VSCROLL | The user has clicked the edit control's vertical scroll bar or has scrolled the mouse wheel over the edit control. The system sends this message before updating the screen.

In addition, the system sends a WM_CTLCOLOREDIT message to an edit control's parent window before the edit control is drawn. This message contains a handle of the edit control's display context (DC) and a handle of the child window. The parent window can use these handles to change the edit control's text and background colors.


Group boxes

A group box is a rectangle that surrounds a set of controls, such as check boxes or radio buttons, with application-defined text (label) in its upper left corner. The sole purpose of a group box is to organize controls related by a common purpose (usually indicated by the label). The group box has only one style, defined by the constant BS_GROUPBOX. Because a group box cannot be selected, it has no check state, focus state, or push state. An application cannot send messages to a group box.

Styles

Normally, group boxes look like this:

This group box has the text "Offset" and contains an edit field.

A group box with the "Flat" style looks like this:

Other styles can be used.


List boxes

List box items can be represented by text strings, bitmaps, or both. If the list box is not large enough to display all the list box items at once, the list box provides a scroll bar. The user scrolls through the list box items, and applies or removes selection status as necessary. Selecting a list box item changes its visual appearance, usually by changing the text and background colors to those specified by the relevant operating system metrics. When the user selects or deselects an item, the system sends a notification message to the parent window of the list box.

Styles

  • Multiple selection.Turns string selection on or off each time the user clicks or double-clicks a string in the list box. The user can select any number of strings.

  • Extended selection. Allows multiple items to be selected by using the SHIFT key and the mouse or special key combinations.

  • Multi column. Specifies amulti columnn list box that is scrolled horizontally. The LB_SETCOLUMNWIDTH message sets the width of the columns.

  • Standard. orts strings in the list box alphabetically. The parent window receives an input message whenever the user clicks or double-clicks a string. The list box has borders on all sides.

  • Sort. The strings in the list box are sorted.

  • Notification. Notifies the parent window with an input message whenever the user clicks or double-clicks a string in the list box.

  • Vert scroll. List box has a vertical scroll

  • Horz scroll. The list box has an horizontal scroll.

  • Tab stop. The control can be reached with the TAB key.

  • No auto redraw. Specifies that the list box's appearance is not updated when changes are made. To change the redraw state of the control, use the WM_SETREDRAW message.

  • No auto vscroll. Shows a disabled vertical scroll bar for the list box when the box does not contain enough items to scroll. If you do not
    specify this style, the scroll bar is hidden when the list box does not contain enough items.

  • No integral height. Specifies that the size of the list box is exactly the size specified by the application when it created the list box. Normally, the system sizes a list box so that the list box does not display partial items.

  • Want keyboard. Specifies that the owner of the list box receives WM_VKEYTOITEM messages whenever the user presses a key and the list box has the input focus. This enables an application to perform special processing on the keyboard input.

  • Owner draw fixed. Specifies that the owner of the list box is responsible for drawing its contents and that the items in the list box are the same height. The owner window receives a WM_MEASUREITEM message when the list box is created and a WM_DRAWITEM message when a visual aspect of the list box has changed.

  • Owner draw variable.Specifies that the owner of the list box is responsible for drawing its contents and that the items in the list box are variable in height. The owner window receives a WM_MEASUREITEM message for each item in the combo box when the combo box is created and a WM_DRAWITEM message when a visual aspect of the combo box has changed.

  • Local storage. Specifies that a list box contains items consisting of strings. The list box maintains the memory and addresses for the strings so that the application can use the LB_GETTEXT message to retrieve the text for a particular item. By default, all list boxes except owner-drawn list boxes have this style. You can create an owner-drawn list box either with or without this style.

  • Help id.The list box can receive a WM_HELP message

Functions provided for list boxes within the generated framework

int GetCurSel(void)

int SetCurSel(int SelectionIndex)

This functions return or set the current selection.

Example:

ST_LISTBOX *listBox;

...

int sel = listBox->GetCurSel();

listBox->SetCurSel(1); // Set selection to second line

int GetAnchorIndex(void);

This method retrieves the anchor index, i.e. the index from which a multiple selection starts. A multiple selection spans all items from the anchor item to the caret item.

Example:

ST_LISTBOX *listBox;

...

int start = listBox->GetAnchorIndex();

int GetCaretIndex(void)

Retrieves the caret index of a multiple selection list box.

int AddString(char *str)

Adds a string to a list box. If the list box has the sorted style, the listbox is sorted, if not, the line is added at the end of the list.

int InsertString(int index,char *str)

Inserts a string always at the given position. If "index" is -1, the string will be added at the end of the listbox.

int GetCount(void)

Retrieves the number of items in a list box.


List views

List-view controls display items in four different views. The control's window style specifies the current view. Additional window styles specify the alignment of items and control-specific features. The following table describes the four views.

View Name | Description | Image
Icon view | Specified by the LVS_ICON window style. Each item appears as a full-sized icon with a label below it. The user can drag the items to any location in the list-view window. |
Small icon view | Specified by the LVS_SMALLICON window style. Each item appears as a small icon with the label to the right of it. The user can drag the items to any location. |
List view | Specified by the LVS_LIST window style. Each item appears as a small icon with a label to the right of it. Items are arranged in columns and the user cannot drag them to an arbitrary location. |
Report view | Specified by the LVS_REPORT window style. Each item appears on its own line, with information arranged in columns. The leftmost column is always left justified and contains the small icon and label. Subsequent columns contain subitems as specified by the application. Each column has a header, unless you also specify the LVS_NOCOLUMNHEADER window style. |

You can change the view type after you create a list-view control. To retrieve and change the window style, use the GetWindowLong and SetWindowLong functions. To determine the window styles of the current view, use the LVS_TYPEMASK value.

You can control the way items are arranged in icon or small icon view by specifying either the LVS_ALIGNTOP (default) or LVS_ALIGNLEFT window style.

You can change the alignment after you create a list-view control. To determine the current alignment, use the LVS_ALIGNMASK value.

Styles

  • No button like header. Column headers are not displayed in report view. By default, columns have headers in report view.
  • Auto arrange. Icons are automatically kept arranged in icon and small icon view.
  • Single line label text. Item text is displayed on a single line in icon view. By default, item text may wrap in icon view.
  • Owner draw fixed. The owner window can paint items in report view. The list-view control sends a WM_DRAWITEM message to paint each item; it does not send separate messages for each subitem. The iItemData member of the DRAWITEMSTRUCT structure contains the item data for the specified list-view item.
  • Share image lists. The image list will not be deleted when the control is destroyed. This style enables the use of the same image lists with multiple list-view controls.
  • Edit labels. Item text can be edited in place. The parent window must process the LVN_ENDLABELEDIT notification message.
  • No scroll. Scrolling is disabled. All items must be within the client area. This style is not compatible with the LVS_LIST or LVS_REPORT styles.
  • Sort. Can be one of: none (no sort), ascending or descending.


Month Calendar

The month calendar control implements a calendar-like user interface. This provides the user with a very intuitive and recognizable method of entering or selecting a date. The control also provides the application with the means to obtain and set the date information in the control using existing data types.

Styles

  • Hide "Today" line.The month calendar control will not display the "today" date at the bottom of the control.
  • No circle around 'today'.The month calendar control will not circle the "today" date.
  • Display week number.The month calendar control will display week numbers (1-52) to the left of each row of days. Week 1 is defined as the first week that contains at least four days


Progress controls

A progress bar is a window that an application can use to indicate the progress of a lengthy operation. It consists of a rectangle that is gradually filled with the system highlight color as an operation progresses

Range and Current Position

A progress bar's range represents the entire duration of the operation, and the current position represents the progress that the application has made toward completing the operation. The window procedure uses the range and the current position to determine the percentage of the progress bar to fill with the highlight color. Because the range and current position values are expressed as unsigned integers, the highest possible range or current position value is 65,535.

The minimum value in the range can be from 0 to 65,535. Likewise, the maximum value can be from 0 to 65,535. If you do not set the range values, the system sets the minimum value to 0 and the maximum value to 100. You can adjust the range to convenient integers by using the PBM_SETRANGE message.

A progress bar provides several messages that you can use to set the current position. The PBM_SETPOS message sets the position to a given value. The PBM_DELTAPOS message advances the position by adding a specified value to the current position.

The PBM_SETSTEP message allows you to specify a step increment for a progress bar. Subsequently, whenever you send the PBM_STEPIT message to the progress bar, the current position advances by the specified increment. By default, the step increment is set to 10.


Radio buttons

A radio button consists of a round button and application-defined text (a label), an icon, or a bitmap that indicates a choice the user can make by selecting the button. An application typically uses radio buttons in a group box to permit the user to choose from a set of related, but mutually exclusive options. For example, the application might present a group of radio buttons from which the user can select a format preference for text selected in the client area. The user could select a left-aligned, right-aligned, or centered format by selecting the corresponding radio button. Typically, the user can select only one option at a time from a set of radio buttons.

A radio button can be one of two styles: standard or automatic, as defined by the constants BS_RADIOBUTTON and BS_AUTORADIOBUTTON. Each style can assume two check states: checked (a dot in the button) or cleared (no dot in the button). Repeatedly selecting a radio button (standard or automatic) toggles it from checked to cleared and back again.

When the user selects either state, the radio button receives the keyboard focus. The system sends the button's parent window a WM_COMMAND message containing the BN_CLICKED notification code. The parent window doesn't acknowledge this message if it comes from an automatic radio button because the system automatically sets the check state for that style. But the parent window should acknowledge the message if it comes from a radio button because the parent window is responsible for setting the check state for that style. Regardless of the radio button style, the system automatically repaints the button as its state changes.

Styles

Normally, radio buttons look like this:

If you select the "Flat" style, they will look like this:

Similarly to check boxes, they can be made to appear like push buttons:

This styles can be combined, for instance to have a flat, push like radio button.


The slider control

This control allows you to input analog values in an easy to understand fashion. Here is a screen shot of different sliders with different attributes.

:

Sliders can be drawn in vertical or horizontal position, with rounded or not pointers, with ticks above or below, etc.

To control the different options you use the following properties dialog box.

The slider interfaces with the dialog box that contains it only with the WM_HSCROLL or the WM_VSCROLL message. Weditres will add code to handle those messages and call your callback procedure when the slider wants to say to you something.

You can add a range of values, and Weditres will generate code to set that range of values at run time during the initialization of the dialog box.

The other styles shown are the usual ones already explained in all the other controls (visible, tab stop, etc). They will not be repeated here.


Spin Control

A sin control, also called up-down control, is a pair of arrow buttons that the user can click to increment or decrement a value, such as a scroll position or a number displayed in a companion control. The value associated with an up-down control is called its current position. An up-down control is most often used with a companion control, which is called a buddy window

Styles

  • Select buddy automatically.If this style is specified, the up-down control automatically selects the previous window in the z-order as its buddy window. This window might be the previous control in a dialog box template. You can use UDM_SETBUDDY to assign a specific buddy window to an up-down control. To determine an up-down control's current buddy window, use the UDM_GETBUDDY message. An up-down control and its buddy window must have the same parent window.
  • No thousands. An up-down control with this style sets the caption of its buddy window whenever the current position changes. The control inserts a thousands separator between every three digits of a decimal string unless the UDS_NOTHOUSANDS style is specified. If the buddy window is a list box, an up-down control sets its current selection instead of its caption.
  • Set buddy integer. An up-down control with this style sets the caption of its buddy window whenever the current position changes.
  • Wrap beyond selected range. By default, the current position does not change if the user attempts to increment it or decrement it beyond the maximum or minimum value. You can change this behavior by using the UDS_WRAP style, so the position "wraps" to the opposite extreme. For example, incrementing past the upper limit wraps the position back to the lower limit.
  • Use arrow keys. You can specify this style to provide a keyboard interface for an up-down control. If this style is specified, the control processes the and keys. The control also subclasses the buddy window so that it can process these keys when the buddy window has the focus.
  • Alignment. An up-down control with the UDS_ALIGNLEFT or UDS_ALIGNRIGHT style aligns with the left or right edge of its buddy window. The width of the buddy window is decreased to accommodate the width of the up-down control.


Tree control

A tree-view control is a window that displays a hierarchical list of items, such as the headings in a document, the entries in an index, or the files and directories on a disk. Each item consists of a label and an optional bitmapped image, and each item can have a list of subitems associated with it. By clicking an item, the user can expand or collapse the associated list of subitems.

Styles

  • Lines to join items.This style enhances the graphic representation of a tree-view control's hierarchy by drawing lines that link child items to their parent item. This style does not link items at the root of the hierarchy. To do so, you need to combine this style with the "lines at root position".
  • Buttons indicate item state.The user can expand or collapse a parent item's list of child items by double-clicking the parent item. A tree-view control that has this style adds a button to the left side of each parent item. The user can click the button once instead of double-clicking the parent item to expand or collapse the child. This style does not add buttons to items at the root of the hierarchy. To do so, you must combine "Lines to join items", "Lines at root position", and this style.
  • Edit labels.This style style makes it possible for the user to edit the labels of tree-view items.
  • Lines at root position. This style makes the control draw lines at the root of the hierarchy.
  • Always shows selection. This style causes a selected item to remain selected when the tree-view control loses focus.
  • The TVS_CHECKBOXES style creates checkboxes next to each item. If you want to use the checkbox style, you must set the TVS_CHECKBOXES style (with SetWindowLong) after you create the tree-view control and before you populate the tree. Otherwise, the checkboxes might appear unchecked, depending on timing issues.

Initializing the Image List

Every item in a tree-view control can have two images associated with it. An item displays one image when it is selected and the other when it is not. To include images with tree-view items, first use the Image Lists functions to create an image list and add images to it. Then associate the image list with the tree-view control by using the TVM_SETIMAGELIST message.

The following example creates an image list, adds three bitmaps to the list, and associates the image list with a tree-view control.

// InitTreeViewImageLists - creates an image list, adds three bitmaps
// to it, and associates the image list with a tree-view control.
// Returns TRUE if successful, or FALSE otherwise.
// hwndTV - handle to the tree-view control.
//
// Global variables and constants
// g_nOpen, g_nClosed, and g_nDocument - integer variables for
// indexes of the images.
// CX_BITMAP and CY_BITMAP - width and height of an icon.
// NUM_BITMAPS - number of bitmaps to add to the image list.

BOOL InitTreeViewImageLists(HWND hwndTV)
{
    HIMAGELIST himl;  // handle to image list
    HBITMAP hbmp;     // handle to bitmap

    // Create the image list.
    if ((himl = ImageList_Create(CX_BITMAP,
                                 CY_BITMAP,
                                 FALSE,
                                 NUM_BITMAPS, 0)) == NULL)
        return FALSE;

    // Add the open file, closed file, and document bitmaps.
    hbmp = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDB_OPEN_FILE));
    g_nOpen = ImageList_Add(himl, hbmp, (HBITMAP)NULL);
    DeleteObject(hbmp);

    hbmp = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDB_CLOSED_FILE));
    g_nClosed = ImageList_Add(himl, hbmp, (HBITMAP)NULL);
    DeleteObject(hbmp);

    hbmp = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDB_DOCUMENT));
    g_nDocument = ImageList_Add(himl, hbmp, (HBITMAP)NULL);
    DeleteObject(hbmp);

    // Fail if not all of the images were added.
    if (ImageList_GetImageCount(himl) < 3)
        return FALSE;

    // Associate the image list with the tree-view control.
    TreeView_SetImageList(hwndTV, himl, TVSIL_NORMAL);

    return TRUE;
}

Adding Tree-View Items

You add an item to a tree-view control by sending the TVM_INSERTITEM message to the control. The message includes the address of a TVINSERTSTRUCT structure, specifying the parent item, the item after which the new item is inserted, and a TVITEM structure that defines the attributes of the item. The attributes include the item's label, its selected and nonselected images, and a 32-bit application-defined value.

The example in this section demonstrates how to create a table of contents based on the information in a text file. The example includes two functions. The first function searches a file for headings. When it finds one, it extracts the text of the heading and the value that indicates the level of the heading and then passes them to the second function.

The second function adds an item to a tree-view control, using the heading text as the item's label and the heading level to determine the parent item for the new item. A level one heading is added to the root of the tree-view control, a level two heading is added as a child item of the previous level one item, and so on. The function assigns an image to an item based on whether it has any child items. If an item has child items, it gets an image representing a closed folder. Otherwise, it gets an image representing a document. An item uses the same image for both the selected and nonselected states

// InitTreeViewItems - extracts headings from the specified file and
// passes them to a function that adds them to a tree-view control.
// Returns TRUE if successful, or FALSE otherwise.
// hwndTV - handle to the tree-view control.
// lpszFileName - name of file with headings.

BOOL InitTreeViewItems(HWND hwndTV, LPSTR lpszFileName)
{
    HANDLE hf;            // handle to file
    char szItemText[128]; // label text of tree-view item
    int nLevel;           // heading level

    // Open the file to parse.
    if ((hf = CreateFile(lpszFileName,
                         GENERIC_READ,
                         FILE_SHARE_READ,
                         (LPSECURITY_ATTRIBUTES)NULL,
                         OPEN_EXISTING,
                         FILE_ATTRIBUTE_NORMAL,
                         (HANDLE)NULL)) == (HANDLE)INVALID_HANDLE_VALUE)
         return FALSE;

    // Call private function to parse the file looking for headings.
    while (GetNextHeadingAndLevelFromFile(hf, szItemText, &nLevel))

         // Add the item to the tree-view control.
         AddItemToTree(hwndTV, szItemText, nLevel);

    return TRUE;
}

// AddItemToTree - adds items to a tree-view control.
// Returns the handle to the newly added item.
// hwndTV - handle to the tree-view control.
// lpszItem - text of the item to add.
// nLevel - level at which to add the item.

HTREEITEM AddItemToTree(HWND hwndTV, LPSTR lpszItem, int nLevel)
{
    TVITEM tvi;
    TVINSERTSTRUCT tvins;
    static HTREEITEM hPrev = (HTREEITEM)TVI_FIRST;
    static HTREEITEM hPrevRootItem = NULL;
    static HTREEITEM hPrevLev2Item = NULL;
    HTREEITEM hti;

    tvi.mask = TVIF_TEXT | TVIF_IMAGE
               | TVIF_SELECTEDIMAGE | TVIF_PARAM;

    // Set the text of the item.
    tvi.pszText = lpszItem;
    tvi.cchTextMax = sizeof(tvi.pszText)/sizeof(tvi.pszText[0]);

    // Assume the item is not a parent item, so give it a
    // document image.
    tvi.iImage = g_nDocument;
    tvi.iSelectedImage = g_nDocument;

    // Save the heading level in the item's application-defined
    // data area.
    tvi.lParam = (LPARAM)nLevel;
    tvins.item = tvi;
    tvins.hInsertAfter = hPrev;

    // Set the parent item based on the specified level.
    if (nLevel == 1)
        tvins.hParent = TVI_ROOT;
    else if (nLevel == 2)
        tvins.hParent = hPrevRootItem;
    else
        tvins.hParent = hPrevLev2Item;

    // Add the item to the tree-view control.
    hPrev = (HTREEITEM)SendMessage(hwndTV,
                                   TVM_INSERTITEM,
                                   0,
                                   (LPARAM)(LPTVINSERTSTRUCT)&tvins);

    // Save the handle to the item.
    if (nLevel == 1)
        hPrevRootItem = hPrev;
    else if (nLevel == 2)
        hPrevLev2Item = hPrev;

    // The new item is a child item. Give the parent item a
    // closed folder bitmap to indicate it now has child items.
    if (nLevel > 1)
    {
        hti = TreeView_GetParent(hwndTV, hPrev);
        tvi.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;
        tvi.hItem = hti;
        tvi.iImage = g_nClosed;
        tvi.iSelectedImage = g_nClosed;
        TreeView_SetItem(hwndTV, &tvi);
    }

    return hPrev;
}


The accelerator table editor

An accelerator table is an association from keyboard keys combinations with a command item. This can be a menu command item, but this is not necessarily the case. When the user presses the defined keyboard keys combination (Ctrl+Shift+N, for example), the window procedure associated with the accelerator table will receive a WM_COMMAND message, containing the numerical value that you associated with this keyboard combination.

For instance, when you want that Ctrl+Shift+N do something special in your application, you define an accelerator key like

1) In your header file:

#define MENU_STOPCALCULATING 3000

2) In your resource file:

"^N" MENU_STOPCALCULATING    SHIFT CONTROL

3) In your window procedure:

switch(message) {

     ...

     case WM_COMMAND:

          switch(LOWORD(wParam)) {

              case MENU_STOPCALCULATING:

                   if (CalculationsStarted()) {

                        StopCals();

                   }

                   break;

          }

}

You can have a menu item somewhere, with an item 'Stop calculations" but this is not mandatory. You receive from windows this message when you do not forget to add the TranslateMessage step in that famous MainLoop of your window procedure.

You can edit this table graphically from Weditres. To call the corresponding editor you should either use the menu item in the 'Objects' bar, or use the directory tree. There, (if there is already a resource table defined in the application), you will find your table. Just double click in its name and the accelerator editor will be called automatically.

The editor for this resource type is very simple. It will show you at startup a list of all defined items. You can perform the usual actions (Add, Modify, and Delete), with three buttons at the lower right.

If there is no accelerator table defined, the editor will automatically start the 'Add' action, supposing you are not very interested in contemplating an empty list. The Add/Change dialog box edits a single line of the accelerator table.

Instead of showing here yet another screen shot, I think it is better to spend more time explaining the concepts behind this.

Each entry in the table consists of:

· A numerical value. This is the result of pressing the combination of keys.

· An associated numerical identifier.

· A set of flags that determine how the numerical value is interpreted.

You can define either plain Ascii keys combinations, or you can set the 'Virtual Key' flag, that indicates to Windows that the value is to be interpreted as a value for a virtual key, i.e. a key like VK_F1, VK_BACK, etc. All those values are defined in <windows.h>, and they give the programmer a view of the keyboard that is independent from the type of keyboard that is used.

It is important to be clear that the ASCII/VIRTUAL KEY flags are alternatives (hence the radio buttons in the editor). You can only use one of those.

You can add flags specifying:

CONTROL: That flag means that the CONTROL key has to be pressed for the keys combination to be valid.

SHIFT: Ditto but with the key Shift.

ALT: The same for the Alt key.

NOINVERT: This means that the menu item associated with the same identifier should not be highlighted if it exists at all.

These flags are not alternatives, they can all be set for the same key combination. They can be set/unset using the checkboxes in the dialog box that edits each line of the table.

The accelerator resource is named following the same conventions as the naming of all other resource types: either with a character string or an identifier. You load the resource using the LoadAccelerators window function that searches for the specified accelerator table.


The menu editor

The menu editor shows you the menu in the form of a tree. Each top level pop-up corresponds to the top level items of the menu being edited.

To add a menu item just type insert (the ‘ins’ key), selecting before the menu item above the one you will introduce.

You do the same for introducing a new menu item in a pop-up.

You can test your menu to see it in ‘action’ by choosing ‘test’ in the ‘File’ option of the main menu of the menu editor.

Besides the tree with the items, you will se the following dialog box floating around. Here you enter the name of the menu, its associated symbol (#define), and its value.

In the ‘Options’ group you can change the appearance of the menu item, either for a normal menu item, or for a popup menu. Do not forget to press ‘Apply’ when you are done with changes.


The string table editor

This utility allows you to edit the string tables contained in your resource file. String tables are a resource kind for storing character strings in the resource section of the executable instead of using string literal in the program text itself.

The original motivation for this was the ever-growing need under windows 3.0 to have more memory with the space severely limited to 64K for the stack, all character strings, and all static data. This lead to trying to make more space in the data segment by putting the strings somewhere else, and loading /unloading them as needed.

But there are many other beneficial side effects, so the usage of string tables has stayed with us even in windows 98. One of the good side effects is the separation from message text from the code itself, so that if you need to translate the program into another language you do not need to edit the source files, but just the resource file, what is far easier for the person who is doing the translation, since he/she doesn’t have to be a programmer AND a foreign language expert, a rare combination.

The string editor presents a simple interface. You double click in a string to edit one, or you can add/delete strings, as you may esteem necessary.

The ‘Save’ button doesn’t save the modified resources to the disk immediately, but just writes it to the resource file in memory. It will get written to disk when you exit weditres.


F:\Borland\Resource Compiler Borland.rtf

Vu dans BCBYTOOL.hlp Borland

+$#KKUsing command-line resource tools
There are several Borland command-line resource tools:
Resource compiler
BRCC32.EXEBRCC32 is the Borland resource compiler. It compiles resource script files (.RC files) and produces the binary .RES file.
Resource linkers
RLINK32.DLLRLINK is the Borland resource linker that binds resources, in .RES file form, to an .EXE file, and marks the resulting .EXE file as a Windows executable. RLINK32.DLL is accessed through ILINK32.EXETLINK.
Resource shells
BRC32.EXEBRC32 is a shell through which BRCC32 and RLINK32 (through ILINK32) can be started in a single step.
+$#KKResource compiler (BRCC32)
See also!AL(`resource tools') ExamplesBRCC32Examples
BRCC32 is the command-line version of the resource compiler. It accepts a resource script file (.RC) as input and produces a resource object file (.RES) as output.
Syntax
BRCC32 [options] <filename>.RC
Command-line options
BRCC32 accepts these options:
Option Description

@responsefile Takes instructions from the specified command file.
-c <code page> Uses the specified code page for resource translation. If -c is not used, the default ANSI code page is used.
-d<name>[=<string>] Defines a preprocessor symbol.
-fo<filename> Renames the output .RES file. (By default, BRCC32 creates the output .RES file with the same name as the input .RC file.)
-i<path> Adds one or more directories (separated by semicolons) to the include search path.
-l<language> Specifies default language.
-m Indicates that the code page specified with the -c switch contains double-byte character set (DBCS) characters.
-r This switch is ignored. It is included for compatibility with other resource compilers.
-v Prints progress messages (verbose).
-x Deletes the current include path.
-? or -h Displays help.
-16 Builds a 16-bit resource.
-32 Builds a 32-bit resource.
BRCC32 predefines common resource-related Windows constants such as WS_VISIBLE and BS_PUSHBUTTON. Also, two special compiler-related symbols are defined: RC_INVOKED and WORKSHOP_INVOKED. These symbols can be used in the source text in conjunction with conditional preprocessor statements to control compilation. For example, the following construct can greatly speed up compilation:
#ifndef WORKSHOP_INVOKED
#include "windows.h"
#endif
Downward compatibility
The following syntax and options are supported for downward compatibility:
Syntax
BRCC32 [options] <filename>.RC
Command-line options
BRCC32 accepts these options:
Option Description

-31 Builds Windows 3.1-compatible .RES files.
-w32 Builds Win32-compatible .RES files.
+$#KResource compiler examples
See also!AL(`resource tools')
The following example adds two directories to the include path and produces a .RES file with the same name as the input .RC file.
brcc32 -i<dir1>;<dir2> <filename>.RC
This example produces an output .RES file with a name different from the input .RC file name:
brcc32 -fo<filename>.RES <filename>.RC
This example builds a 16-bit .RES file:
brcc32 -16 -fo<filename>.RES <filename>.RC
+$#KKResource linker (RLINK32.DLL)
See also!AL(`resource tools')
RLINK32 combines a .RES file with an .EXE file to produce a new Windows executable. RLINK32 accepts as input one or more object (.RES) files and a single Windows executable file. RLINK32 links the resources by fixing up string tables and message tables and then binding these linked resources into the executable. RLINK32 is called by ILINK32 and is used for 32-bit resources.

+$#KKResource shell (BRC32)
See also!AL(`resource tools') ExamplesBRC32Examples
The Borland resource compiler (BRC32) is a resource compiler shell. It invokes BRCC32 and RLINK32, depending on the command-line syntax.
Syntax
brc32 [options] <filename>.RC [<filename>.EXE]
Command-line options
BRC32 accepts these options:
Switch Description

-d<name>[=string] Defines a symbol you can test with the #IFDEF preprocessor directive.
-fo<filename> Renames the .RES file.
-fe<filename> Renames the .EXE file.
-i<path> Adds one or more directories (separated by semicolons) to the include search path.
-r Creates a .RES file only. The compiled .RES file is not added to the .EXE.
-v Prints progress messages (verbose listing).
-x Directs the compiler to ignore the INCLUDE environment variable when it searches for include or resource files.
-16 Builds 16-bit .RES files.
-32 Builds 32-bit .RES files.
-Vd.d Makes the .EXE file with Windows version provided (v3.1 is the default for 16-bit resources; -v4.0 is the default for 32-bit resources). Version options are listed in the following table.
Option Bit Resulting look

3.1 16 Gives white background with a non 3-D look for Windows 3.1x, Windows 32s, or WinNT 3.1
4.0 16 Gives gray 3-D look for Windows 95 and WinNT 3.51
3.1 32 Gives white background with a non 3-D look for Windows 32s or WinNT 3.1
4.0 32 Gives gray 3-D look for Windows 95 and WinNT 3.51

The following switches are invalid when the -r switch is specified:

-k Disables the contiguous preload of segments and resources in the .EXE file. Segments are kept in the order in which they appear in the .DEF file. (This option only applies to 16-bit resources.)
-t Creates an application that runs only in protected mode (Windows Standard or 386 Enhanced mode).
Downward compatibility
The following syntax and options are supported for downward compatibility
Syntax
brc32 [switches] <filename>.RC [<filename>.EXE]
Command-line options
BRC32 accepts these options:
Option Description

-31 Builds Windows 3.1-compatible .RES files.
-w32 Builds Win32-compatible .RES files.
+$#KResource shell examples
See also!AL(`resource tools')
The following statement compiles the .RC file, creates a .RES file, and adds the .RES file to the executable file:
brc32 <filename>.RC [<filename>.EXE]
BRC32 automatically seeks an .EXE file with the same name as the .RC file. You need to specify the .EXE file only if its name is different from that of the .RC file.
The following statement creates a .RES file, but not an .EXE file. If you name an .EXE file in the command line, BRC ignores it:
brc32 -r <filename>.RC
The following statement adds an existing .RES file to an executable file. The .EXE file name is required only if it differs from the .RES file name:
brc32 <filename>.RES [<filename>.EXE]
This example uses BRC32 to build a 16-bit Windows 3.1 compatible .RES file:
brc32 -16 -v3.1 -fo<filename>.RES <filename>.RC


D:\COM_CHM\Documentation CHM\_API\RC Resource Compiler\RTF\RC_Borland.RTF

Using the Resource Compiler Vu dans RC.hlp 238_Ko Borland
The Microsoft Windows Resource Compiler (RC) is a tool for the Microsoft Windows operating system. This overview describes how to create a resource-definition (script) file, and how to compile your application's resources and add them to the application.
$#About the Resource Compiler
To include resources in your Win32-based application with RC, do the following:
1. Create individual resource files for your cursors, icons, bitmaps, dialog boxes, and fonts. To do this, you can use the Microsoft Image Editor (IMAGEDIT.EXE), Dialog Editor (DLGEDIT.EXE), and Font Editor (FONTEDIT.EXE) included with the Win32 SDK or equivalent tools.
2. Create a resource-definition script (.RC file) that describes all the resources used by your application. For more information, see Creating a Resource-Definition File.
3. Compile the script into a resource file with RC. For more information, see Using RC (The RC Command Line).
4. Link the compiled resource file into the application's executable file with your linker.
$#Creating a Resource-Definition File
After creating individual resource files for your application's icon, cursor, font, bitmap, and dialog-box resources, you create a resource-definition file, or script. A script file is a text file with the extension .RC.
The script lists every resource in your application and describes some types of resources in great detail. For a resource that exists in a separate file, such as an icon or cursor, the script names the resource and the file that contains it. For some resources, such as a menu, the entire definition of the resource exists within the script.
A script file can contain the following types of information:
· Preprocessor directives, which instruct RC to perform actions on the script before compiling it. Directives can also assign values to names.
· Resource-definition statements, which name and describe resources. These consist of single-line statements and multiline statements.
The following sections describe directives and statements you can use in a script.
$#Preprocessor Directives
The following directives can be used as needed in the script to instruct RC to perform actions or to assign values to names:
Directive Description
#define Defines a specified name by assigning it a given value.
#elif Marks an optional clause of a conditional-compilation block.
#else Marks the last optional clause of a conditional-compilation block.
#endif Marks the end of a conditional-compilation block.
#if Conditionally compiles the script if a specified expression is true.
#ifdef Conditionally compiles the script if a specified name is defined.
#ifndef Conditionally compiles the script if a specified name is not defined.
#include Copies the contents of a file into the resource-definition file.
#undef Removes the definition of the specified name.

The syntax and semantics for the RC preprocessor are the same as for a C compiler. For more information on preprocessing in RC, see Preprocessor Directives Reference.
It's a good idea to test whether your files are being compiled by the RC compiler or a C compiler, because there are some directives that you can use in a header file that the C compiler will accept but RC will not. RC defines RC_INVOKED. Therefore, use
#ifndef RC_INVOKED

and
#endif

in header files that will be included in both .RC and .C files to surround things that RC can not compile.
$#Resource-Definition Statements
This section describes the statements that define the resources that the resource compiler puts in the resource (.RES) file. Once a resource is linked to the executable file, the application can load the resource as it is needed at run time. All resource statements associate an identifying name or number with a given resource.
#Common Control Parameters
The general syntax for a control definition, and the meaning of each parameter is as follows:
control [text,] i d, x, y, wi dth, he ight [, style [, extended-style]]
Horizontal dialog units are 1/4 of the dialog base width unit. Vertical units are 1/8 of the dialog base height unit. The current dialog base units are computed from the height and width of the current system font. The GetDialogBaseUnits function returns the dialog base units in pixels. The coordinates are relative to the origin of the dialog box.
Parameters
control
Keyword that indicates the type of control being defined, such as PUSHBUTTON or CHECKBOX.
text
Specifies text that is displayed with the control. The text is positioned within the control's specified dimensions or adjacent to the control.
This parameter must contain zero or more characters enclosed in double quotation marks ("). Strings are automatically null-terminated and converted to Unicode in the resulting resource file.
By default, the characters listed between the double quotation marks are ANSI characters, and escape sequences are interpreted as byte escape sequences. If the string is preceded by the L prefix, the string is a wide-character string and escape sequences are interpreted as 2-byte escape sequences that specify Unicode characters. If a double quotation mark is required in the text, you must include the double quotation mark twice.
An ampersand (&) character in the text indicates that the following character is used as a mnemonic character for the control. When the control is displayed, the ampersand is not shown, but the mnemonic character is underlined. The user can choose the control by pressing the key corresponding to the underlined mnemonic character. To use the ampersand as a character in a string, insert two ampersands (&&).
id
Specifies the control identifier. This value must be a 16-bit unsigned integer in the range 0 through 65,535 or a simple arithmetic expression that evaluates to a value in that range.
x
Specifies the x-coordinate of the left side of the control relative to the left side of the dialog box. This value must be a 16-bit unsigned integer in the range 0 through 65,535. The coordinate is in dialog units and is relative to the origin of the dialog box, window, or control containing the specified control.
y
Specifies the y-coordinate of the top side of the control relative to the top of the dialog box. This value must be a 16-bit unsigned integer in the range 0 through 65,535. The coordinate is in dialog units relative to the origin of the dialog box, window, or control containing the specified control.
width
Specifies the width of the control. This value must be a 16-bit unsigned integer in the range 1 through 65,535. The width is in 1/4-character units.
height
Specifies the height of the control. This value must be a 16-bit unsigned integer in the range 1 through 65,535. The height is in 1/8-character units.
style
Specifies the control styles. Use the bitwise OR (|) operator to combine styles.
extended-style
Specifies extended (WS_EX_xxx) styles. You must specify a style to specify an extended-style. See also EXSTYLE.

Occasionally, a statement will use a parameter differently, or may ignore a parameter. The statement-specific variation is described with the statement in the reference section.
#Common Resource Attributes
All resource-definition statements include a load-mem option that specifies the loading and memory characteristics of the resource. These attributes are divided into two groups: load attributes and memory attributes. The only attribute that is used by a Win32-based application is the DISCARDABLE attribute. The remaining attributes are allowed in the script for backward compatibility with existing scripts, but are ignored.
Load Attributes
The load attributes specify when the resource is to be loaded. The load parameter must be one of the following:
PRELOAD
Ignored. In 16-bit Windows, the resource is loaded with the executable file.
LOADONCALL
Ignored. In 16-bit Windows, the resource is loaded when called.

Memory Attributes
The memory attributes specify whether the resource is fixed or movable, whether it is discardable, and whether it is pure. The memory parameter can be one or more of the following:
FIXED
Ignored. In 16-bit Windows, the resource remains at a fixed memory location.
MOVEABLE
Ignored. In 16-bit Windows, the resource can be moved if necessary in order to compact memory.
DISCARDABLE
Resource can be discarded if no longer needed.
PURE
Ignored. Accepted for compatibility with existing resource scripts.
IMPURE
Ignored. Accepted for compatibility with existing resource scripts.

The default for cursor, icon, and font resources is DISCARDABLE.
$#Single-Line Statements
A single-line statement can begin with any of the following keywords:
Keyword Description
BITMAP Defines a bitmap by naming it and specifying the name of the file that contains it. (To use a particular bitmap, the application requests it by name.)
CURSOR Defines a cursor or animated cursor by naming it and specifying the name of the file that contains it. (To use a particular cursor, the application requests it by name.)
FONT Specifies the name of a file that contains a font.
ICON Defines an icon or animated icon by naming it and specifying the name of the file that contains it. (To use a particular icon, the application requests it by name.)
LANGUAGE Sets the language for all resources up to the next LANGUAGE statement or to the end of the file. When the LANGUAGE statement appears before the BEGIN in an ACCELERATORS, DIALOG, MENU, RCDATA, or STRINGTABLE resource definition, the specified language applies only to that resource.
MESSAGETABLE Defines a message table by naming it and specifying the name of the file that contains it. The file is a binary resource file generated by the Message Compiler.

$#Multiline Statements
A multiline statement can begin with any of the following keywords:
Keywo
rd Description
ACCELERATORS Defines menu accelerator keys.
DIALOG Defines a template that an application can use to create dialog boxes.
MENU Defines the appearance and function of a menu.
RCDATA Defines data resources. Data resources let you include binary data in the executable file.
STRINGTABLE Defines string resources. String resources are Unicode strings that can be loaded from the executable file.

Eac
h of these multiline statements allows optional statements before the BEGIN ... END block that defines the resource. You can specify zero or more of the following statements:
Statement Description
CHARACTERISTICS dword User-defined information about the resource that can be used by tools that read and write resource files. The value appears in the compiled resource file. However, it is not stored in the executable file and is not used by Windows.
LANGUAGE language, sublanguage Specifies the language for the resource. The parameters are constants from WINNT.H.
VERSION dword User-defined version number for the resource that can be used by tools that read and write resource files. The value appears in the compiled resource file. However, it is not stored in the executable file and is not used by Windows.

$#Sample Resource-Definition File
The following example shows a script file that defines the resources for an application named Shapes:
#include "SHAPES.H"ShapesCursor CURSOR SHAPES.CURShapesIcon ICON SHAPES.ICOShapesMenu MENU BEGIN POPUP "&Shape" BEGIN MENUITEM "&Clear", ID_CLEAR MENUITEM "&Rectangle", ID_RECT MENUITEM "&Triangle", ID_TRIANGLE MENUITEM "&Star", ID_STAR MENUITEM "&Ellipse", ID_ELLIPSE END END

The CURSOR statement names the application's cursor resource ShapesCursor and specifies the cursor file SHAPES.CUR, which contains the image for that cursor.
The ICON statement names the application's icon resource ShapesIcon and specifies the icon file SHAPES.ICO, which contains the image for that icon.
The MENU statement defines an application menu named ShapesMenu, a pop-up menu with five menu items.
The menu definition, enclosed by the BEGIN and END keywords, specifies each menu item and the menu identifier that is returned when the user selects that item. For example, the first item on the menu, Clear, returns the menu identifier ID_CLEAR when the user selects it. The menu identifiers are defined in the application header file, SHAPES.H.
$#Using RC (The RC Command Line)
To start RC, use the RC command. The following line shows RC command-line syntax:
RC [options] script-file
The RC command's options parameter can include one or more of the following options:
/?
Displays a list of RC command-line options.
/d
Defines a symbol for the preprocessor that you can test with the #ifdef directive.
/foresname
Uses resname fo r the name of the .RES file.
/h
Displays a list of RC command-line options.
/i
Searches the specified directory before searching the directories specified by the INCLUDE environment variable.
/lcodepage
Specifies defa ult language for compilation. For example, -l409 is equivalent to including the following statement at the top of the resource script file:
LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US

/r
Ignored. Provided for compatibility with existing makefiles.
/u
Undefines a symbol for the preprocessor.
/v
Displays messages that report on the progress of the compiler.
/x
Prevents RC from checking the INCLUDE environment variable when searching for header files or resource files.

Options are not case sensitive, and a hyphen (-) can be used in place of a slash mark (/). You can combine single-letter options if they do not require any additional parameters. For example, the following two commands are equivalent:
RC /V /X SAMPLE.RC
rc -vx sample.rc

The script-file parameter specifies the name of the resource-definition file that contains the wnames, types, filenames, and descriptions of the resources to be compiled.
$#Defining Names for the Preprocessor
You can specify conditional compilation in a script, based on whether a name is defined on the RC command line with the /d option, or in the file or an include file with the #define directive.
For example, suppose your application has a pop-up menu, the Debug menu, that should appear only with debugging versions of the application. When you compile the application for normal use, the Debug menu is not included. The following example shows the statements that can be added to the resource-definition file to define the Debug menu:
MainMenu MENUBEGIN . . .#ifdef DEBUG POPUP "&Debug" BEGIN MENUITEM "&Memory usage", ID_MEMORY MENUITEM "&Walk data heap", ID_WALK_HEAP END#endifEND

When compiling resources for a debugging version of the application, you could include the Debug menu by using the following RC command:
rc -d DEBUG myapp.rc

To compile resources for a normal version of the application¾one that does not include the Debug menu¾you could use the following RC command:
rc myapp.rc

$#Renaming the Compiled Resource File
By default, when compiling resources, RC names the compiled resource (.RES) file with the base name of the .RC file and places it in the same directory as the .RC file. CVTRES must then be invoked to convert the .RES file to a binary resource (.RBJ) format which can be understood by the linker. The following example compiles MYAPP.RC and creates a compiled resource file named MYAPP.RES in the same directory as MYAPP.RC:
rc myapp.rc

The /fo option gives the resulting .RES file a name that differs from the name of the corresponding .RC file. For example, to name the resulting .RES file NEWFILE.RES, use the following command:
rc -fo newfile.res myapp.rc

The /fo option can also place the .RES file in a different directory. For example, the following command places the compiled resource file MYAPP.RES in the directory C:\SOURCE\RESOURCE:
rc -fo c:\source\resource\myapp.res myapp.rc

$#Searching for Files
By default, RC searches for header files and resource files (such as icon and cursor files) first in the current directory and then in the directories specified by the INCLUDE environment variable. (The PATH environment variable has no effect on which directories RC searches.)
$#Adding a Directory to Search
You can use the /i option to add a directory to the list of directories RC searches. The compiler then searches the directories in the following order:
1. The current directory
2. The directory or directories you specify by using the /i option, in the order in which they appear on the RC command line
3. The list of directories specified by the INCLUDE environment variable, in the order in which the variable lists them, unless you specify the /x option

The following example compiles the resource-definition file MYAPP.RC:
rc /i c:\source\stuff /i d:\resources myapp.rc

When compiling the script MYAPP.RC, RC searches for header files and resource files first in the current directory, then in C:\SOURCE\STUFF and D:\RESOURCES, and then in the directories specified by the INCLUDE environment variable.
$#Suppressing the INCLUDE Environment Variable
You can prevent RC from using the INCLUDE environment variable when determining the directories to search. To do so, use the /x option. The compiler then searches for files only in the current directory and in any directories you specify by using the /i option.
The following example compiles the script file MYAPP.RC:
rc /x /i c:\source\stuff myapp.rc

When compiling the script MYAPP.RC, RC searches for header files and resource files first in the current directory and then in C:\SOURCE\STUFF. It does not search the directories specified by the INCLUDE environment variable.
$#Displaying Progress Messages
By default, RC compiles quietly. It does not display messages that report on its progress. You can, however, specify that RC is to display these messages. To do so, use the /v option.
The following example causes RC to report on its progress as it compiles the resource-definition file SAMPLE.RC and creates the compiled resource file SAMPLE.RES:
rc /v sample.rc

$#Resource Compiler Reference
This section describes the resource-definition statements, preprocessor directives, and diagnostic messages used by the resource compiler.
$#Resource-Definition Statements Reference
This section describes the resource and control statements.
$#ACCELERATORS Resource {bmc bm00.BMP} {bmc bm10.BMP}
The ACCELERATORS statement defines one or more accelerators for an application. An accelerator is a keystroke defined by the application to give the user a quick way to perform a task. The TranslateAccelerator function is used to translate accelerator messages from the application queue into WM_COMMAND or WM_SYSCOMMAND messages.
Syntax
acctablename ACCELERATORS[optional-statements]BEGIN event, idvalue, [type] [options] . . .END
Param eters
acc tablename
Specifies either a unique name or a 16-bit unsigned integer value that identifies the resource.
optional-statements
Zero or more of the following statements:
Statement Description
CHARACTERISTICS dword U
ser-defined information about a resource that can be used by tools that read and write resource files.
LANGUAGE language, sublanguage Specifies the language for the resource. The parameters are constants from WINNT.H.
VERSION dword User-defined version number for the resource that can be used by tools that read and write resource files.

event
Specifies the keystroke to be used as
an accelerator. It can be any one of the following character types:
"char"
A single character enclosed in double quotation marks ("). The character can be preceded by a caret (^), meaning that the character is a control character.
character
An integer value representing a character. The type parameter must be ASCII.
virtual-key character
An integer value representing a virtual key. The virtual key for alphanumeric keys can be specified by placing the uppercase letter or number in double quotation marks (for example, "9" or "C"). The type parameter must be VIRTKEY.

idvalue
Specifies a 16-bit unsigned integer value that identifies the accelerator.
type
Required only when the event parameter is a character or a virtual-key character. The type parameter specifies either ASCII or VIRTKEY; the integer value of event is interpreted accordingly. When VIRTKEY is specified and event contains a string, event must be uppercase.
options
Specifies the options that define the accelerator. This parameter can be one or more of the following values:
NOINVERT
Specifies that no top-level menu item is highlighted when the accelerator is used. This is useful when defining accelerators for actions such as scrolling that do not correspond to a menu item. If NOINVERT is omitted, a top-level menu item will be highlighted (if possible) when the accelerator is used.
ALT
Causes the accelerator to be activated only if the ALT key is down.
SHIFT
Causes the accelerator to be activated only if the SHIFT key is down.
CONTROL
Defines the character as a control character (the accelerator is only activated if the CONTROL key is down). This has the same effect as using a caret (^) before the accelerator character in the event parameter.

The ALT, SHIFT, and CONTROL options apply only to virtual keys.
Example
The following example demonstrates the use of accelerator keys:
1 ACCELERATORSBEGIN "^C", IDDCLEAR ; control C "K", IDDCLEAR ; shift K "k", IDDELLIPSE, ALT ; alt k 98, IDDRECT, ASCII ; b 66, IDDSTAR, ASCII ; B (shift b) "g", IDDRECT ; g "G", IDDSTAR ; G (shift G) VK_F1, IDDCLEAR, VIRTKEY ; F1 VK_F1, IDDSTAR, CONTROL, VIRTKEY ; control F1 VK_F1, IDDELLIPSE, SHIFT, VIRTKEY ; shift F1 VK_F1, IDDRECT, ALT, VIRTKEY ; alt F1 VK_F2, IDDCLEAR, ALT, SHIFT, VIRTKEY ; alt shift F2 VK_F2, IDDSTAR, CONTROL, SHIFT, VIRTKEY ; ctrl shift F2 VK_F2, IDDRECT, ALT, CONTROL, VIRTKEY ; alt control F2END

See Also
TranslateAcceleratorCHARACTERISTICS, DIALOG, LANGUAGE, MENU, RCDATA, STRINGTABLE, VERSION
$#AUTO3STATE Control
The AUTO3STATE statement creates an automatic 3-state check box. The control is an open box with the given text positioned to the right of the box. When chosen, the box automatically advances between three states: checked, unchecked, and disabled (grayed). The control sends a message to its parent whenever the user chooses the control.
Syntax
AUTO3STATE text, id, x, y, width, height [, style [, extended-style]]
Parameters
sty le
Spe cifies styles for the control, which can be a combination of the BS_AUTO3STATE style and the following styles: WS_TABSTOP, WS_DISABLED, and WS_GROUP.
The default style for this control is BS_AUTO3STATE and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.
See Also
AUTOCHECKBOX, CHECKBOX, CONTROL, STATE3
$#AUTOCHECKBOX Control
The AUTOCHECKBOX statement creates an automatic check box control. The control is a small rectangle (check box) that has the specified text displayed next to it (typically, to the right). When the user chooses the control, the control highlights the rectangle and sends a message to its parent window. The AUTOCHECKBOX statement, which can only be used in the body of a DIALOG statement, defines the text, identifier, dimensions, and attributes of the control.
Syntax
AUTOCHECKBOX text, id, x, y, width, height [, style [, extended-style]]
Paramet ers
styl e
S pec ifies t he styles of the control. This value can be a combination of the button class style BS_AUTOCHECKBOX and the WS_TABSTOP and WS_GROUP styles.
If you do not specify a style, the default style is BS_AUTOCHECKBOX and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.
See Also
AUTO3STATE, CHECKBOX, CONTROL, STATE3
$#AUTORADIOBUTTON Control
The AUTORADIOBUTTON control statement specifies an automatic radio button control. This control automatically performs mutual exclusion with the other AUTORADIOBUTTON controls in the same group. When the button is chosen, the application is notified with BN_CLICKED.
Syntax
AUTORADIOBUTTON text, id, x, y, width, height [, style [, extended-style]]
Parameters
t ext
The sp ecified text appears next to the radio button.
style
Specifies styles for the automatic radio button, which can be a combination of BUTTON-class styles and the following styles: WS_TABSTOP, WS_DISABLED, and WS_GROUP.
The default style for AUTORADIOBUTTON is BS_AUTORADIOBUTTON and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.
See Also
CONTROL, RADIOBUTTON
$#BITMAP Resource {bmc bm00.BMP} {bmc bm10.BMP}
The BITMAP resource-definition statement specifies a bitmap that an application uses in its screen display or as an item in a menu or control.
Syntax
nameID BITMAP [load-mem] filename
Parameters
nameID
Specifies either a unique name or a 16-bit unsigned integer value identifying the resource.
load-mem
Specifies loading and memory attributes for the resource. For more information, see Common Resource Attributes.
filename
Specifies the name of the file that contains the resource. The name must be a valid filename; it must be a full path if the file is not in the current working directory. The path can either be a quoted or nonquoted string.

Example
The following example specifies two bitmap resources:
disk1 BITMAP disk.bmp12 BITMAP PRELOAD diskette.bmp

See Also
LoadBitmap
$#CAPTION Statement
The CAPTION statement defines the title for a dialog box. The title appears in the box's caption bar (if it has one).
The default caption is empty.
Syntax
CAPTION "captiontext"
Parameter
captiontext
Specifies a character string enclos ed in doubl e quotation marks (").
Example
The following example demonstrates the use of the CAPTION statement:
CAPTION "Error!"

$#CHARACTERISTICS Statement
The CHARACTERISTICS statement allows the developer to specify information about a resource that can be used by tools that read and write resource-definition files. The specified dword value appears with the resource in the compiled .RES file. However, the value is not stored in the executable file and has no significance to Windows.
The CHARACTERISTICS statement appears before the BEGIN in an ACCELERATORS, DIALOG, MENU, RCDATA, or STRINGTABLE resource definition. The specified value applies only to that resource.
Syntax
CHARACTERISTICS dword
Parameter
dword
A user-defined doubleword value.

See Also
ACCELERATORS, DIALOG, LANGUAGE, MENU, RCDATA, STRINGTABLE
$#CHECKBOX Control
The CHECKBOX statement creates a check box control. The control is a small rectangle (check box) that has the specified text displayed next to it (typically, to the right). When the user selects the control, the control highlights the rectangle and sends a message to its parent window. The CHECKBOX statement, which can only be used in a DIALOG statement, defines the text, identifier, dimensions, and attributes of the control.
Syntax
CHECKBOX text, id, x, y, width, height [, style [, extended-style]]
Parameters
text
S peci fie s t ext tha t is displayed to the right of the control.
style
Specifies the control styles. This value can be a combination of the button class style BS_CHECKBOX and the WS_TABSTOP and WS_GROUP styles.
If you do not specify a style, the default style is BS_CHECKBOX and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.
Example
This example creates a check-box control that is labeled "Italic":
CHECKBOX "Italic", 3, 10, 10, 40, 10

See Also
AUTOCHECKBOX, AUTO3STATE, GetDialogBaseUnits, STATE3
$#CLASS Statement
The CLASS statement defines the class of the dialog box. The CLASS statement appears in the optional section before a DIALOG statement's BEGIN keyword. If no class is given, the Windows standard dialog class is used.
Syntax
CLASS class
Parameters
class
Specifies a 16-bit unsigned integer or a string, enclosed in double quotation marks ("), that identifies the class of the dialog box. If the window procedure for the class does not process a message sent to it, it must call the DefDlgProc function to ensure that all messages are handled properly for the dialog box. A private class can use DefDlgProc as the default window procedure. The class must be registered with the cbWndExtra member of the WNDCLASS structure set to DLGWINDOWEXTRA.

Remarks
The CLASS statement should only be used with special cases, because it overrides the normal processing of a dialog box. The CLASS statement converts a dialog box to a window of the specified class; depending on the class, this could give undesirable results. Do not use the redefined control-class names with this statement.
Example
The following example demonstrates the use of the CLASS statement:
CLASS "myclass"

See Also
DefDlgProc, DIALOG
$#COMBOBOX Control
The COMBOBOX statement creates a combination box control (a combo box). A combo box consists of either a static text box or an edit box combined with a list box. The list box can be displayed at all times or pulled down by the user. If the combo box contains a static text box, the text box always displays the selection (if any) in the list box portion of the combo box. If it uses an edit box, the user can type in the desired selection; the list box highlights the first item (if any) that matches what the user has entered in the edit box. The user can then select the item highlighted in the list box to complete the choice. In addition, the combo box can be owner-drawn and of fixed or variable height.
Syntax
COMBOBOX text, id, x, y, width, height [, style [, extended-style]]
Parameters
style
Sp ecif ies th e contr ol styles. This value can be a combination of the COMBOBOX class styles and any of the following styles: WS_TABSTOP, WS_GROUP, WS_VSCROLL, and WS_DISABLED.
If you do not specify a style, the default style is CBS_SIMPLE and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.
Example
This example creates a combo-box control with a vertical scroll bar:
COMBOBOX 777, 10, 10, 50, 54, CBS_SIMPLE | WS_VSCROLL | WS_TABSTOP

$#CONTROL: General Control
This statement defines a user-defined control window.
Syntax
CONTROL text, id, class, style, x, y, width, height [, extended-style]
Parameters
class
Spe cifies a redef ine d n ame, ch aracter string, or a 16-bit unsigned integer value that defines the class. This can be any one of the control classes; for a list of the control classes, see the first list following this description. If the value is a redefined name supplied by the application, it must be a string enclosed in double quotation marks (").
style
Specifies a redefined name or integer value that specifies the style of the given control. The exact meaning of style depends on the class value. The sections following this description show the control classes and corresponding styles.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.
The six possible control classes are described in the following sections.
$#The Button Control Class
A button control is a small rectangular child window that represents a "button" that the user can turn on or off by clicking it with the mouse. Button controls can be used alone or in groups, and can either be labeled or appear without text. Button controls typically change appearance when the user clicks them.
A button can have only one of the following styles, with the exception of BS_LEFTTEXT, which can be combined with check boxes and radio buttons:
BS_3STATE
Creates a button that is the same as a check box, except that the box can be grayed (dimmed) as well as checked. The grayed state is used to show that the state of the check box is not determined.
BS_AUTO3STATE
Creates a button that is the same as a three-state check box, except that the box changes its state when the user selects it. The state cycles through checked, grayed, and normal.
BS_AUTOCHECKBOX
Creates a button that is the same as a check box, except that an X appears in the check box when the user selects the box; the X disappears (is cleared) the next time the user selects the box.
BS_AUTORADIOBUTTON
Creates a button that is the same as a radio button, except that when the user selects it, the button automatically highlights itself and clears (removes the selection from) any other buttons in the same group.
BS_CHECKBOX
Creates a small square that has text displayed to its right (unless this style is combined with the BS_LEFTTEXT style).
BS_DEFPUSHBUTTON
Creates a button that has a heavy black border. The user can select this button by pressing the ENTER key. This style is useful for enabling the user to quickly select the most likely option (the default option).
BS_GROUPBOX
Creates a rectangle in which other controls can be grouped. Any text associated with this style is displayed in the rectangle's upper-left corner.
BS_LEFTTEXT
Places text on the left side of the radio button or check box when combined with a radio button or check box style.
BS_OWNERDRAW
Creates an owner-drawn button. The owner window receives a WM_MEASUREITEM message when the button is created, and it receives a WM_DRAWITEM message when a visual aspect of the button has changed. The BS_OWNERDRAW style cannot be combined with any other button styles.
BS_PUSHBUTTON
Creates a push button that posts a WM_COMMAND message to the owner window when the user selects the button.
BS_RADIOBUTTON
Creates a small circle that has text displayed to its right (unless this style is combined with the BS_LEFTTEXT style). Radio buttons are usually used in groups of related but mutually exclusive choices.

$#The Combobox Control Class
Combo-box controls consist of a selection field similar to an edit control plus a list box. The list box may be displayed at all times or may be dropped down when the user selects a "pop box" next to the selection field.
Depending on the style of the combo box, the user can or cannot edit the contents of the selection field. If the list box is visible, typing characters into the selection box will cause the first list-box entry that matches the characters typed to be highlighted. Conversely, selecting an item in the list box displays the selected text in the selection field. Combo-box control styles are described below.
CBS_SIMPLE
Displays the list box at all times. The current selection in the list box is displayed in the edit control.
CBS_DROPDOWN
Similar to CBS_SIMPLE except that the list box is not displayed unless the user selects an icon next to the selection field.
CBS_DROPDOWNLIST
Similar to CBS_DROPDOWN except that the edit control is replaced by a static text item which displays the current selection in the list box.
CBS_OWNERDRAWFIXED
Specifies a fixed-height owner-draw combo box. The owner of the list box is responsible for drawing its contents; the items in the list box are all the same height.
CBS_OWNERDRAWVARIABLE
Specifies a variable-height owner-draw combo box. The owner of the list box is responsible for drawing its contents; the items in the list box can have different heights.
CBS_AUTOHSCROLL
Scrolls the text in the edit control to the right when the user types a character at the end of the line. If this style is not set, only text that fits within the rectangular boundary is allowed.
CBS_SORT
Sorts strings entered into the list box.
CBS_HASSTRINGS
Specifies an owner-draw combo box that contains items consisting of strings. The combo box maintains the memory and pointers for the strings so that the application can use the LB_GETTEXT message to retrieve the text for a particular item.
CBS_OEMCONVERT
Converts text entered in the combo box edit control from the ANSI character set to the OEM character set and then back to ANSI. This ensures proper character conversion when the application calls the CharToOem function to convert an ANSI string in the combo box to OEM characters. This style is most useful for combo boxes that contain filenames and applies only to combo boxes created with the CBS_SIMPLE or CBS_DROPDOWN styles.

$#The Edit Control Class
An edit control is a rectangular child window in which the user can enter text from the keyboard. The user selects the control, and gives it the input focus, by clicking the mouse inside it or pressing the TAB key. The user can enter text when the control displays a flashing insertion point. The mouse can be used to move the cursor and select characters to be replaced, or to position the cursor for inserting characters. The BACKSPACE key can be used to delete characters.
Edit controls use the fixed-pitch font and display Unicode characters. They expand tab characters into as many space characters as are required to move the cursor to the next tab stop. Tab stops are assumed to be at every eighth character position. Edit control styles are described below.
ES_LEFT
Justifies the text to the left.
ES_CENTER
Centers the text. This style is valid in multiline edit controls only.
ES_RIGHT
Justifies the text to the right. This style is valid in multiline edit controls only.
ES_LOWERCASE
Converts all characters to lowercase as they are typed into the edit control.
ES_UPPERCASE
Converts all characters to uppercase as they are typed into the edit control.
ES_PASSWORD
Displays all characters as an asterisk (*) as they are typed into the edit control. An application can use the EM_SETPASSWORDCHAR message to change the character that is displayed.
ES_MULTILINE
Multiple-line edit control. (The default is single-line.) Shows as many lines of text as possible. The following four styles specify options for horizontal and vertical scrolling.
ES_AUTOVSCROLL specified
Shows as many lines as possible and scrolls vertically when the user presses ENTER. (This is actually the carriage-return character, which the edit control expands to a carriage-return - linefeed combination.)
ES_AUTOVSCROLL not specified
Shows as many lines as possible and beeps if the user presses ENTER when no more lines can be displayed.
ES_AUTOHSCROLL specified
Scrolls horizontally when the insertion point goes past the right edge of the control. To start a new line, press ENTER.
ES_AUTOHSCROLL not specified
Wraps words to the beginning of the next line when necessary. A new line is also started if the user presses ENTER. If the window size changes, the word-wrap position changes, and the text is redisplayed.
Multiple-line edit controls can have scroll bars. An edit control with scroll bars processes its own scroll-bar messages. Edit controls without scroll bars scroll as described above and process any scroll messages sent by the parent window.
ES_AUTOVSCROLL
Scrolls text automatically up one page when the user presses ENTER on the last line.
ES_AUTOHSCROLL
Scrolls text automatically to the right by 10 characters when the user types a character at the end of the line. When the user presses ENTER, the control scrolls all text back to position 0.
ES_NOHIDESEL
Overrides the default action, in which an edit control hides the selection when the control loses the input focus. Inverts the selection instead.
ES_OEMCONVERT
Converts text entered in the edit control from the ANSI character set to the OEM character set and then back to ANSI. This ensures proper character conversion when the application calls the CharToOem function to convert an ANSI string in the edit control to OEM characters. This style is most useful for edit controls that contain filenames.

$#The Listbox Control Class
Listbox controls consist of a list of character strings. The control is used whenever an application needs to present a list of names, such as filenames, that the user can view and select. The user can select a string by pointing to the string with the mouse and clicking a mouse button. When a string is selected, it is highlighted and a notification message is passed to the parent window. A scroll bar can be used with a listbox control to scroll lists that are too long or too wide for the control window. Listbox control styles are described below.
LBS_STANDARD
Strings in the list box are sorted alphabetically and the parent window receives an input message whenever the user clicks or double-clicks a string. The list box contains borders on all sides.
LBS_DISABLENOSCROLL
Shows a disabled vertical scroll bar for the list box when the box does not contain enough items to scroll. If this style is not specified, the scroll bar is hidden when the list box does not contain enough items.
LBS_EXTENDEDSEL
The user can select multiple items using the mouse with the SHIFT and/or the CONTROL key or special key combinations.
LBS_HASSTRINGS
An owner-draw list box contains items consisting of strings. The list box maintains the memory and pointers for the strings so the application can use the LB_GETTEXT message to retrieve the text for a particular item.
LBS_NOTIFY
The parent receives an input message whenever the user clicks or double-clicks a string.
LBS_MULTIPLESEL
The string selection is toggled each time the user clicks or double-clicks the string. Any number of strings can be selected.
LBS_MULTICOLUMN
The list box contains multiple columns. The list box can be scrolled horizontally. The LB_SETCOLUMNWIDTH message sets the width of the columns.
LBS_NOINTEGRALHEIGHT
The size of the list box is exactly the size specified by the application when it created the list box. Normally, Windows sizes a list box so that the list box does not display partial items.
LBS_SORT
The strings in the list box are sorted alphabetically.
LBS_NOREDRAW
The list-box display is not updated when changes are made. This style can be changed at any time by sending a WM_SETREDRAW message.
LBS_OWNERDRAWFIXED
The owner of the list box is responsible for drawing its contents; the items in the list box are all the same height.
LBS_OWNERDRAWVARIABLE
The owner of the list box is responsible for drawing its contents; the items in the list box are variable in height.
LBS_USETABSTOPS
The list box is able to recognize and expand tab characters when drawing its strings. The default tab positions are set at every 32 dialog units. (A dialog unit is a horizontal or vertical distance. One horizontal dialog unit is equal to 1/4 of the current dialog base width unit. The dialog base units are computed from the height and width of the current system font. The GetDialogBaseUnits function returns the size of the dialog base units in pixels.)
LBS_WANTKEYBOARDINPUT
The owner of the list box receives WM_VKEYTOITEM or WM_CHARTOITEM messages whenever the user presses a key while the list box has input focus. This allows an application to perform special processing on the keyboard input.

$#The Scroll-Bar Control Class
A scroll-bar control is a rectangle that contains a scroll thumb and has direction arrows at both ends. The scroll bar sends a notification message to its parent whenever the user clicks the mouse in the control. The parent is responsible for updating the thumb position, if necessary. Scroll-bar controls have the same appearance and function as the scroll bars used in ordinary windows. But unlike scroll bars, scroll-bar controls can be positioned anywhere within a window and used whenever needed to provide scrolling input for a window. Scroll-bar control styles are described below.
SBS_VERT
Vertical scroll bar. If neither SBS_RIGHTALIGN nor SBS_LEFTALIGN is specified, the scroll bar has the height, width, and position given in the CreateWindow function.
SBS_RIGHTALIGN
Used with SBS_VERT. The right edge of the scroll bar is aligned with the right edge of the rectangle specified by the x, y, width, and height values given in the CreateWindow function. The scroll bar has the default width for system scroll bars.
SBS_LEFTALIGN
Used with SBS_VERT. The left edge of the scroll bar is aligned with the left edge of the rectangle specified by the x, y, width, and height values given in the CreateWindow function. The scroll bar has the default width for system scroll bars.
SBS_HORZ
Horizontal scroll bar. If neither SBS_BOTTOMALIGN nor SBS_TOPALIGN is specified, the scroll bar has the height, width, and position given in the CreateWindow function.
SBS_TOPALIGN
Used with SBS_HORZ. The top edge of the scroll bar is aligned with the top edge of the rectangle specified by the x, y, width, and height values given in the CreateWindow function. The scroll bar has the default height for system scroll bars.
SBS_BOTTOMALIGN
Used with SBS_HORZ. The bottom edge of the scroll bar is aligned with the bottom edge of the rectangle specified by the x, y, width, and height values given in the CreateWindow function. The scroll bar has the default height for system scroll bars.
SBS_SIZEBOX
Size box. If neither SBS_SIZEBOXBOTTOMRIGHTALIGN nor SBS_SIZEBOXTOPLEFTALIGN is specified, the size box has the height, width, and position given in the CreateWindow function.
SBS_SIZEBOXTOPLEFTALIGN
Used with SBS_SIZEBOX. The top-left corner of the size box is aligned with the top-left corner of the rectangle specified by the x, y, width, and height values given in the CreateWindow function. The size box has the default size for system size boxes.
SBS_SIZEBOXBOTTOMRIGHTALIGN
Used with SBS_SIZEBOX. The bottom-right corner of the size box is aligned with the bottom-right corner of the rectangle specified by the x, y, width, and height values given in the CreateWindow function. The size box has the default size for system size boxes.

$#The Static Control Class
Static controls are simple text fields, boxes, and rectangles that can be used to label, box, or separate other controls. Static controls take no input and provide no output. Static control styles are described below.
SS_LEFT
A simple rectangle displaying the given text flush left. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line.
SS_CENTER
A simple rectangle displaying the given text centered. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line.
SS_RIGHT
A simple rectangle displaying the given text flush right. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line.
SS_LEFTNOWORDWRAP
A simple rectangle displaying the given text flush left. Tabs are expanded, but words are not wrapped. Text that extends past the end of a line is clipped.
SS_SIMPLE
A simple rectangle with a single line of text flush left. The line of text cannot be shortened or altered in any way. (The control's parent window or dialog box must not process the WM_CTLCOLOR message.)
SS_NOPREFIX
Removes any ampersand (&) characters and underlines the next character in the string. Unless this style is specified, Windows will interpret any ampersand characters in the control's text to be accelerator prefix characters. If a static control is to contain text where this feature is not wanted, SS_NOPREFIX may be added. This static-control style may be included with any of the defined static controls.
You can combine SS_NOPREFIX with other styles by using the bitwise OR (|) operator. This is most often used when filenames or other strings that may contain an ampersand need to be displayed in a static control in a dialog box.
SS_ICON
An icon displayed in the dialog box. The given text is the name of an icon (not a filename) defined elsewhere in the resource file. For the ICON statement, the width and height parameters in the CreateWindow function are ignored; the icon automatically sizes itself.
SS_BLACKRECT
A rectangle filled with the color used to draw window frames. This color is black in the default Windows color scheme.
SS_GRAYRECT
A rectangle filled with the color used to fill the screen background. This color is gray in the default Windows color scheme.
SS_WHITERECT
A rectangle filled with the color used to fill window backgrounds. This color is white in the default Windows color scheme.
SS_BLACKFRAME
Box with a frame drawn with the same color as window frames. This color is black in the default Windows color scheme.
SS_GRAYFRAME
Box with a frame drawn with the same color as the screen background (desktop). This color is gray in the default Windows color scheme.
SS_WHITEFRAME
Box with a frame drawn with the same color as window backgrounds. This color is white in the default Windows color scheme.
SS_USERITEM
User-defined item.

$#CTEXT Control
The CTEXT statement creates a centered-text control. The control is a simple rectangle displaying the given text centered in the rectangle. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line. The CTEXT statement, which you can use only in a DIALOG statement, defines the text, identifier, dimensions, and attributes of the control.
Syntax
CTEXT text, id, x, y, width, height [, style [, extended-style]]
Parameters
text
Specifies t ext tha t i s cente red in the rectangular area of the control.
style
Specifies the control styles. This value can be any combination of the following styles: SS_CENTER, WS_TABSTOP, and WS_GROUP.
If you do not specify a style, the default style is SS_CENTER and WS_GROUP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.
Example
This example creates a centered-text control that is labeled "filename":
CTEXT "filename", 101, 10, 10, 100, 100

See Also
CONTROL, DIALOG, LTEXT, RTEXT
$#CURSOR Resource {bmc bm00.BMP} {bmc bm10.BMP}
The CURSOR statement specifies a bitmap that defines the shape of the cursor on the display screen or an animated cursor.
Syntax
nameID CURSOR [load-mem] filename
Parameters
nameID
Specifies either a unique name or a 16-bit unsigned integer identifying the resource.
load-mem
Specifies loading and memory attributes for the resource. For more information, see Common Resource Attributes.
filename
Specifies the name of the file that contains the resource. The name must be a valid filename; it must be a full path if the file is not in the current working directory. The path can either be a quoted or nonquoted string.

Remarks
Icon and cursor resources can contain more than one image. If the resource is marked with the PRELOAD option, Windows loads all images in the resource when the application executes.
Example
The following example specifies two cursor resources; one by name (cursor1) and the other by number (2):
cursor1 CURSOR bullseye.cur2 CURSOR "d:\\cursor\\arrow.cur"

$#DEFPUSHBUTTON Control
The DEFPUSHBUTTON statement creates a default push-button control. The control is a small rectangle with a bold outline that represents the default response for the user. The given text is displayed inside the button. The control highlights the button in the usual way when the user clicks the mouse in it and sends a message to its parent window.
Syntax
DEFPUSHBUTTON text, id, x, y, width, height [, style [, extended-style]]
Parameters
text
Specifies text tha t i s c entered in the rectangular area of the control.
style
Specifies the control styles. This value can be a combination of the following styles: BS_DEFPUSHBUTTON, WS_TABSTOP, WS_GROUP, and WS_DISABLED.
If you do not specify a style, the default style is BS_DEFPUSHBUTTON and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.
Example
This example creates a default push-button control that is labeled "Cancel":
DEFPUSHBUTTON "Cancel", 101, 10, 10, 24, 50

See Also
PUSHBUTTON, RADIOBUTTON
$#DIALOG Resource {bmc bm00.BMP} {bmc bm10.BMP}
The DIALOG statement defines a window that an application can use to create dialog boxes. The statement defines the position and dimensions of the dialog box on the screen as well as the dialog box style.
Syntax
nameID DIALOG [ load-mem]] x, y, width, height [[optional-statements]] BEGIN control-statement . . .END
Par ame ters
na meID
Identifies the dialog box. This is either a unique name or a unique 16-bit unsigned integer value in the range 1 to 65,535.
load-mem
Specifies loading and memory attributes for the resource. For more information, see Common Resource Attributes.
option-statements
Specifies options for the dialog box. This can be zero or more of the following statements:
CAPTION "text"
Specifies the caption of the dialog box if it has a title bar. See CAPTION for more info rmation.
CHARACTERISTICS dword
Specifies a user-defined double-word value for use by resource tools. This value is not used by Windows. For more information, see CHARACTERISTICS.
CLASS class
Specifies a 16-bit unsigned integer or a string, enclosed in double quotation marks ("), that identifies the class of the dialog box. See CLASS for more information.
LANGUAGE language,sublanguage
Specifies the language of the dialog box. See LANGUAGE for more information.
STYLE styles
Specifies the styles of the dialog box. See STYLE for more information.
EXSTYLE=extended-styles
Specifies the extended styles of the dialog box. See EXSTYLE for more information.
VERSION dword
Specifies a user-defined doubleword value. This statement is intended for use by additional resource tools and is not used by Windows. For more information, see VERSION.

For more information on the x, y, width, and height parameters, see Common Control Parameters.
Remarks
The GetDialogBaseUnits function returns the dialog base units in pixels. The exact meaning of the coordinates depends on the style defined by the STYLE option statement. For child-style dialog boxes, the coordinates are relative to the origin of the parent window, unless the dialog box has the style DS_ABSALIGN; in that case, the coordinates are relative to the origin of the display screen.
Do not use the WS_CHILD style with a modal dialog box. The DialogBox function always disables the parent/owner of the newly created dialog box. When a parent window is disabled, its child windows are implicitly disabled. Since the parent window of the child-style dialog box is disabled, the child-style dialog box is too.
If a dialog box has the DS_ABSALIGN style, the dialog coordinates for its upper-left corner are relative to the screen origin instead of to the upper-left corner of the parent window. You would typically use this style when you wanted the dialog box to start in a specific part of the display no matter where the parent window may be on the screen.
The name DIALOG can also be used as the class-name parameter to the CreateWindow function to create a window with dialog box attributes.
Example
The following demonstrates the usage of the DIALOG statement:
#include <windows.h>ErrorDialog DIALOG 10, 10, 300, 110STYLE WS_POPUP|WS_BORDERCAPTION "Error!"
BEGIN CTEXT "Select One:", 1, 10, 10, 280, 12 PUSHBUTTON "&Retry", 2, 75, 30, 60, 12 PUSHBUTTON "&Abort", 3, 75, 50, 60, 12 PUSHBUTTON "&Ignore", 4, 75, 80, 60, 12END

See Also
CONTROL, CreateDialog, CreateWindow, DialogBox, DIALOGEX, GetDialogBaseUnits, ACCELERATORS, CHARACTERISTICS, LANGUAGE, MENU, RCDATA, STRINGTABLE, VERSION
$#DIALOGEX Resource
The DIALOGEX resource is an extension of the DIALOG resource. In addition to the functionality offered by DIALOG, DIALOGEX allows for the following:
· Help IDs on the dialog itself as well as on controls within the dialog.
· Use of the EXSTYLE statement for the dialog itself as well as on controls within the dialog.
· Font weight and italic settings for the font to be used in the dialog.
· Control-specific data for controls within the dialog.
· Use of the BEDIT, IEDIT, and HEDIT predefined system class names.

Syntax
nameID DIALOGEX [[ load-mem]] x, y, width, height [[ , helpID]][[ optional-statements]]BEGIN control-statement . . .END
Par ame ters
na meID
Identifi es the dialog box. This is either a unique name or a unique 16-bit unsigned integer value in the range 1 to 65,535.
load-mem
Specifies loading and memory attributes for the resource. For more information, see Common Resource Attributes.
x
Specifies the location on the screen of the left side of the dialog, in dialog units.
y
Specifies the location on the screen of the top of the dialog, in dialog units.
width
Specifies the width of the dialog, in dialog units.
height
Specifies the height of the dialog, in dialog units.
helpID
Specifies a numeric expression indicating the ID used to identify the dialog during WM_HELP processing.
optional-statements
Specifies options for the dialog box. This can be zero or more of the following statements:
CAPTION "text"
Specifies the caption of the dialog box if it has a title bar. See CAPTION for more information.
CHARACTERISTICS DWORD
Specifies a user-defined DWORD value for use by resource tools. This value is not used by Windows. For more information see CHARACTERISTICS.
CLASS class
Specifies a 16-bit unsigned integer or a string, enclosed in double quotation marks ("), that ident ifies the class of the dialog box. See CLASS for more information.
EXSTYLE=extended-styles
Specifies the extended styles of the dialog box. See EXSTYLE for more information.
FONT pointsize, typeface, weight, italic
pointsize
Specifies the size, in points, of the font.
typeface
Sp ecifies the name of the typeface. This name must be identical to the name defined in the [FONTS] section of WIN.INI. This parameter must be enclosed in double quotation marks (").
weight
Specifies a numeric expression for the font weight (explicit FW_* values defined in WINGDI.H can be used by adding an include to the RC file: #include "WINGDI.H")
italic
Indicates whether the font should be italic or not. Specify either TRUE or FALSE for the italic value.
LANGUAGE language, sublanguage
Specifies the language of the dialog box. See LANGUAGE for more information.
MENU m enuname
Specifies the menu to use. This value is either the name of the menu or the integer identifier.
STYLE styles
Specifies the styles of the dialog box. See STYLE for more information.
VERSION DWORD
Specifies a user-defined DWORD value. This statement is intended for use by additional resource too ls and is not used by Windows. For more information, see VERSION.
The DIALOGEX body is marked with a BEGIN statement at the beginning of the body and an END statement at the end of the body. The body is made up of any number of control statements. There are four families of control statements: generic, static, button, and edit. While each of these families uses a different syntax for defining specific features of its controls, they all share a common syntax for defining the position, size, extended styles, help identification number, and control-specific data. That common syntax is:
(controlType), x, y, cx, cy [, [exStyle] [, helpID] [BEGIN data-element-1 [, data-element-2 [, ... ]] END]
(co ntrolTy pe)
F amily-specific definition ¾ described below.
x
Specifies the location in the dialog of the lef t side of the control, in dialog units.
y
Specifies the location in the dialog of the top of the control, in dialog units.
cx
Specifies the width of the control, in dialog units.
c79
Specifies the height of the control, in dialog units.
exStyle
Specifies any number of extended window styles (explicit WS_EX_* style values defined in winuser.h can be used by adding an include to the RC file: #include "winuser.h")
helpID
Specifies a numeric expression indicating the ID used to identify the control during WM_HELP processing.
controlData
Marked by a nested BEGIN and END, specifies the control-specific data for the control. When a dialog is created, and a control in that dialog which has control-specific data is created, a pointer to that data is passed into the control's window procedure via the lParam to the WM_CREATE message for that control.

Following is the family-specific syntax of the (controlType):
Generic control:
CONTROL controlText, id, className, style
controlText
Specifies the window text for the control. For more information, see Common C on tr ol Parame te rs.
id
Specifies the control identifier. For more information, see Common Control Parameters.
className
Specifies the name of the class. This may be either a string enclosed in double quotation marks (") or one of the following predefined system classes: BUTTON, STATIC, EDIT, LISTBOX, SCROLLBAR, or COMBOBOX.
style
Specifies the window styles (explicit WS_*, BS_*, SS_*, ES_*, LBS_*, SBS_*, and CBS_* style values defined in WINUSER.H can be used by adding an include to the RC file: #include "WINUSER.H")

Static control:
staticClass controlText, id
staticClass {LTEXT | RTEXT | CTEXT}

controlText
Specifies the window text for the control. For more inf ormation, see Common Control Parameters.
id
Specifies the control identifier. For more information, see Common Control Parameters.

Button control:
buttonClass controlText, id
buttonClass {AUTO3STATE | AUTOCHECKBOX | AUTORADIOBUTTON | CHECKBOX | PUSHBOX | PUSHBUTTON | RADIOBUTTON | STATE3 | USERBUTTON}

controlText
Specifies the window text for the control. For more information, see Common Control Parameters.
id
Specifies the control identifier. For more information, see Common Control Parameters.
Edit control:
editClass id
editClass {EDITTEXT | BEDIT | HEDIT | IEDIT}

id
Specifies the control identifier. For more information, s ee Common Control Parameters.
Arithmetic and Boolean Operations
Valid operations that may be contained in any of the numeric expressions in the statements of DIALOGEX are:
· Add ('+')
· Subtract ('-')
· Unary minus ('-')
· Unary NOT ('~')
· AND ('&')
· OR ('|')

See Also
CONTROL, CreateDialog, CreateWindow, DialogBox, DIALOGEX, GetDialogBaseUnits, ACCELERATORS, CHARACTERISTICS, LANGUAGE, MENU, RCDATA, STRINGTABLE, VERSION
$#EDITTEXT Control
The EDITTEXT statement defines an EDIT control belonging to the EDIT class. It creates a rectangular region in which the user can type and edit text. The control displays a cursor when the user clicks the mouse in it. The user can then use the keyboard to enter text or edit the existing text. Editing keys include the BACKSPACE and DELETE keys. The user can also use the mouse to select characters to be deleted or to select the place to insert new characters.
Syntax
EDITTEXT text, id, x, y, width, height [[, style [[, extended-style]]]]
Parameters
style
Specifies the control styles. This valu e c an be a co mbination of the edit class styles and the following styles: WS_TABSTOP, WS_GROUP, WS_VSCROLL, WS_HSCROLL, and WS_DISABLED.
If you do not specify a style, the default style is ES_LEFT, WS_BORDER, and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.
Example
The following example demonstrates the use of the EDITTEXT statement:
EDITTEXT 3, 10, 10, 100, 10

$#EXSTYLE Statement
The EXSTYLE command allows you to designate a dialog box with the WS_EX_style styles. In a resource definition, the EXSTYLE statement is placed with the optional statements before the BEGIN keyword.
Syntax
EXSTYLE extended-style
Parameter
extended-style
The WS_EX_style style for the dialog box or control.

Remarks
It can also be placed with the load-mem parameters in a DIALOG statement as follows:
name DIALOG [[load-mem]] EXSTYLE=extended-style x, y, ...
For controls, extended styles are specified after the style option in any control defin ition, as follow s:
control text, id, x, y, width, height, [[style[[, extended-style]]]]

See also
ACCELERATORS, CONTROL, DIALOG, MENU, POPUP, RCDA TA, ST RINGTAB LE, User-Defined Resource
$#FONT Resource {bmc bm00.BMP} {bmc bm10.BMP}
The FONT resource-definition statement specifies a file that contains a font.
For a font resource, nameID must be a number; it cannot be a name.
Syntax
nameID FONT [[load-mem]] filename
Parameters
nameID
Specifies either a unique name or a 16-bit unsigned integer value identifying the resource.
load-mem
Specifies loading and memory attributes for the resource. For more information, see Common Resource Attributes.
filename
Specifies the name of the file that contains the resource. The name must be a valid filename; it must be a full path if the file is not in the current working directory. The path can either be a quoted or nonquoted string.

Example
The following example specifies a single font resource:
5 FONT CMROMAN.FNT

$#FONT Statement
The FONT statement defines the font with which Windows will draw text in the dialog box. The font must have been previously loaded, either from the WIN.INI file or by calling the LoadResource function.
Syntax
FONT pointsize, typeface
Parameters
pointsize
Specifies the size, in points, of the font.
typeface
Specifies the name of the typ eface. This name must be identical to the name defined in the [FONTS] section of WIN.INI. This parameter must be enclosed in double quotes (").

Example
The following example demonstrates the use of the FONT statement:
FONT 12, "MS Shell Dlg"

See Also
DIALOG, LoadResource
$#GROUPBOX Control
The GROUPBOX statement creates a group box control. The control is a rectangle that groups other controls together. The controls are grouped by drawing a border around them and displaying the given text in the upper-left corner. The GROUPBOX statement, which you can use only in a DIALOG statement, defines the text, identifier, dimensions, and attributes of a control window.
When the style contains WS_TABSTOP or the text specifies an accelerator, tabbing or pressing the accelerator key moves the focus to the first control within the group.
Syntax
GROUPBOX text, id, x, y, width, height [[, style [[, extended-style]]]]
Parameters
style
Specifies the control styles. This valu e ca n b e a combin ation of the button class style BS_GROUPBOX and the WS_TABSTOP and WS_DISABLED styles.
If you do not specify a style, the default style is BS_GROUPBOX.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.
Example
This example creates a group-box control that is labeled "Options":
GROUPBOX "Options", 101, 10, 10, 100, 100

See Also
DIALOG
$#ICON Resource {bmc bm00.BMP} {bmc bm10.BMP}
The ICON resource-definition statement specifies a bitmap that defines the shape of the icon to be used for a given application or an animated icon.
Syntax
nameID ICON [[load-mem]] filename
Parameters
nameID
Specifies either a unique name or a 16-bit unsigned integer value identifying the resource.
load-mem
Specifies loading and memory attributes for the resource. For more information, see Common Resource Attributes.
filename
Specifies the name of the file that contains the resource. The name must be a valid filename; it must be a full path if the file is not in the current working directory. The path can either be a quoted or nonquoted string.

Remarks
Icon and cursor resources can contain more than one image. If the resource is marked as PRELOAD, Windows loads all images in the resource when the application executes.
Example
The following example specifies two icon resources:
desk1 ICON desk.ico11 ICON DISCARDABLE custom.ico

$#ICON Control
The ICON statement creates an icon control. This control is an icon displayed in a dialog box. The ICON control statement, which you can use only in a DIALOG statement, defines the icon-resource identifier, icon-control identifier, position, and attributes of a control.
Syntax
ICON text, id, x, y, [[width, height, style [[, extended-style]]]]
Parameters
text
Specifies the name of an icon (not a filenam e) d efi ned elsewher e in the resource file.
width
This value is ignored and should be set to zero.
height
This value is ignored and should be set to zero.
style
Specifies the control style. This parameter is optional. The only value that can be specified is the SS_ICON style. This is the default style whether this parameter is specified or not.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.
Example
This example creates an icon control whose icon identifier is 901 and whose name is "myicon":
ICON "myicon" 901, 30, 30

See Also
DIALOG, ICON
$#LANGUAGE Statement {bmc bm00.BMP} {bmc bm10.BMP}
The LANGUAGE statement sets the language for all resources up to the next LANGUAGE statement or to the end of the file. When the LANGUAGE statement appears before the BEGIN in an ACCELERATORS, DIALOG, MENU, RCDATA, or STRINGTABLE resource definition, the specified language applies only to that resource.
Syntax
LANGUAGE language, sublanguage
Parameters
language
Language identifier. Must be one of the constants from WINNT.H
sublanguage
Sublanguag e identifier. Must be one of the constants from WINNT.H

See Also
ACCELERATORS, CHARACTERISTICS, DIALOG, MENU, RCDATA, STRINGTABLE, VERSION
$#LISTBOX Control
The LISTBOX statement creates commonly used controls for a dialog box or window. The control is a rectangle containing a list of strings (such as filenames) from which the user can select. The LISTBOX statement, which can only be used in a DIALOG or WINDOW statement, defines the identifier, dimensions, and attributes of a control window.
Syntax
LISTBOX id, x, y, width, height [[, style [[, extended-style]]]]
Parameters
style
Specifies the control styles. This value can be a c omb ination of the list-box class styles and any of the following styles: WS_BORDER and WS_VSCROLL.
If you do not specify a style, the default style is LBS_NOTIFY and WS_BORDER.

For more information on the id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.
Example
This example creates a list-box control whose identifier is 101:
LISTBOX 101, 10, 10, 100, 100

See Also
COMBOBOX, DIALOG
$#LTEXT Control
The LTEXT statement creates a left-aligned text control. The control is a simple rectangle displaying the given text left-aligned in the rectangle. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line. The LTEXT statement, which can be used only in a DIALOG statement, defines the text, identifier, dimensions, and attributes of the control.
Syntax
LTEXT text, id, x, y, width, height [[, style [[, extended-style]]]]
Parameters
style
Specifies the control styles. This value can be a ny com binatio n of the BS_RADIOBUTTON style and the following styles: SS_LEFT, WS_TABSTOP, and WS_GROUP.
If you do not specify a style, the default style is SS_LEFT and WS_GROUP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.
Example
This example creates a left-aligned text control that is labeled "Filename":
LTEXT "Filename", 101, 10, 10, 100, 100

See Also
CONTROL, CTEXT, DIALOG, RTEXT
$#MENU Resource {bmc bm00.BMP} {bmc bm10.BMP}
The MENU statement defines the contents of a menu resource. A menu resource is a collection of information that defines the appearance and function of an application menu. A menu is a special input tool that lets a user select commands and open submenus from a list of menu items.
Syntax
menuID MENU [[load-mem]][[optional-statements]]BEGIN item-definitions . . .END
Parameters
menuID
A number that identifies the menu. This value is either a unique string or a unique 16-bit unsigned integer value in the range of 1 to 65,535.
load-mem
An attribute that specifies loading and memory attributes for the resource. For more information, see Common Resource Attributes.
optional-statements
This parameter can be zero of more of the following statements:
Statement Description
CHARACTERISTICS dword User-defined information about a resource that can be used by tools that read and write resource files.
LANGUAGE language, sublanguage Specifies the language for the resource. The parameters are constants from WINNT.H.
VERSION dword User-defined version number for the resource that can be used by tools that read and write resource files.

Example
Following is an example of a complete MENU statement:
sample MENUBEGIN MENUITEM "&Soup", 100 MENUITEM "S&alad", 101 POPUP "&Entree" BEGIN MENUITEM "&Fish", 200 MENUITEM "&Chicken", 201, CHECKED POPUP "&Beef" BEGIN MENUITEM "&Steak", 301 MENUITEM "&Prime Rib", 302 END END MENUITEM "&Dessert", 103END

See Also
MENUEX, MENUITEM, POPUP, ACCELERATORS, CHARACTERISTICS, DIALOG, LANGUAGE, RCDATA, STRINGTABLE, VERSION
$#MENU Statement
The MENU statement defines the dialog box's menu. If no statement is given, the dialog box has no menu.
Syntax
MENU menuname
Parameter
menuname
Specifies the menu to use. This value is either the name of the menu or the integer identifier of the menu.

Example
The following example demonstrates the use of the MENU dialog statement:
MENU errmenu

$#MENUEX Resource
The MENUEX resource is an extension of the MENU resource. In addition to the functionality offered by MENU, MENUEX allows for the following:
· Help identifiers on menus.
· Identifiers on menus.
· Use of the MFT_* type flags and MFS_* state flags. For more information on these flags, see the MENUITEMINFO structure.

Syntax
menuID MENUEXBEGIN [{[MENUITEM itemText [, [id] [, [type] [, state]]]] | [POPUP itemText [, [id] [, [type] [, [state] [, helpID]]]] BEGIN popupBody END]} ...]END
Parameters
MENUITEM statement
Defines a menu item.
itemText
A string containing the text for the menu item. For more information, see MENUITEM.
id
A numeric expression indicating the identifier of the menu item.
type
A numeric expression indicating the type of the menu item To use the predefined MFT_* type values, include the following statement in your .RC file:
#include "WINUSER.H"

state
A numeric expression indicating the state of the menu item To use the predefined MFS_* state values, include the following statement in your .RC file:
#include "WINUSER.H"

POPUP statement
Defines a menu item that has a submenu associated with it.
itemText
A string containing the text for the menu item.
id
A numeric expression indicating the identifier of the menu item.
type
A numeric expression indicating the type of the menu item To use the predefined MFT_* type values, include the following statement in your .RC file:
#include "WINUSER.H"

state
A numeric expression indicating the state of the menu item To use the predefined MFS_* state values, include the following statement in your .RC file:
#include "WINUSER.H"

helpID
A numeric expression indicating the identifier used to identify the menu during WM_HELP processing.

popupBody
Contains any combination of the MENUITEM and POPUP statements.

Remarks
Valid arithmetic and Boolean operations that can be contained in any of the numeric expressions in the statements of MENUEX are:
· Add ('+')
· Subtract ('-')
· Unary minus ('-')
· Unary NOT ('~')
· AND ('&')
· OR ('|')
See Also
MENU, MENUITEM, POPUP, ACCELERATORS, CHARACTERISTICS, DIALOG, LANGUAGE, RCDATA, STRINGTABLE, VERSION
$#MENUITEM Statement
The MENUITEM statement defines a menu item.
Syntax
MENUITEM text, result, [[optionlist]]MENUITEM SEPARATOR
Parameters
text
A string that indicates the name of the menu item.
The string can contain the escape characte rs \t an d \a. The \t character inserts a tab in the string and is used to align text in columns. Tab characters should be used only in menus, not in menu bars. (For information on menus, see POPUP Resource.) The \a character aligns all text that follows it flush right to the menu bar or pop-up menu.
result
A number that specifies the result generated when the user selects the menu item. This parameter takes an integer value. Menu-item results are always integers; when the user clicks the menu-item name, the result is sent to the window that owns the menu.
optionlist
This parameter specifies the appearance of the menu item. This optional parameter takes one or more redefined menu options, separated by commas or spaces. The menu options are as follows:
CHECKED
Menu item has a check mark next to it.
GRAYED
Menu item is initially inactive and appears on the menu in gray or a lightened shade of the menu-text color.
HELP
Identifies a help item.
INACTIVE
Menu item is displayed but it cannot be selected.
MENUBARBREAK
Same as MENUBREAK except that for pop-up menus, it separates the new column from the old column with a vertical line.
MENUBREAK
Places the menu item on a new line for static menu-bar items. For menus, it places the menu item in a new column with no dividing line between the columns.
The INACTIVE and GRAYED options cannot be used together.
SEPARATOR
The MENUITEM SEPARATOR form of the MENUITEM statement creates an inactive menu item that serves as a dividing bar between two active menu items on a menu.

Example
The following example demonstrates the use of the MENUITEM and MENUITEM SEPARATOR statements:
MENUITEM "&Roman", 206, CHECKED, GRAYEDMENUITEM SEPARATORMENUITEM "&Blackletter", 301

See Also
MENU, POPUP
$#MESSAGETABLE Resource {bmc bm00.BMP} {bmc bm10.BMP}
The MESSAGETABLE resource-definition statement defines the ID and file of an application's message table resource. Message tables are special string resources used in event logging and with the FormatMessage function. The file contains a binary message table generated by the Message Compiler. The Message Compiler also generates a resource script file that contains the MESSAGETABLE statements you need to include the message table resources in the compiled resource file. Use the #include directive to include this resource script into your main resource script.
Syntax
nameID MESSAGETABLE filename
Parameters
nameID
Specifies either a unique name or a 16-bit unsigned integer value identifying the resource.
filename
Specifies the name of the file that contains the resource. The name must be a valid filename; it must be a full path if the file is not in the current working directory. The path can either be a quoted or nonquoted string.

See Also
Using the Message Compiler, STRINGTABLE
$#POPUP Resource
The POPUP statement defines a menu item that can contain menu items and submenus.
Syntax
POPUP text, [[optionlist]]BEGIN item-definitions . . .END
Parameters
text
A string that contains the name of the menu. This string must be enclosed in double quotation marks (").
optionlist
This parameter specifies redefined menu options that specify the appearance of the menu item. This optional parameter can be one or more of the following.
CHECKED
Menu item has a check mark next to it. This option is not valid for a top-level menu.
GRAYED
Menu item is initially inactive and appears on the menu in gray or a lightened shade of the menu-text color.
INACTIVE
Menu item is displayed but it cannot be selected.
MENUBARBREAK
Same as MENUBREAK except that for menus, it separates the new column from the old column with a vertical line.
MENUBREAK
Places the menu item on a new line for static menu-bar items. For menus, it places the menu item in a new column with no dividing line between the columns.
The INACTIVE and GRAYED options cannot be used together.

Example
The following example demonstrates the use of the POPUP statement:
chem MENUBEGIN POPUP "&Elements" BEGIN MENUITEM "&Oxygen", 200 MENUITEM "&Carbon", 201, CHECKED MENUITEM "&Hydrogen", 202 MENUITEM SEPARATOR MENUITEM "&Sulfur", 203 MENUITEM "Ch&lorine", 204 END
POPUP "&Compounds" BEGIN POPUP "&Sugars" BEGIN MENUITEM "&Glucose", 301 MENUITEM "&Sucrose", 302, CHECKED MENUITEM "&Lactose", 303, MENUBREAK MENUITEM "&Fructose", 304 END POPUP "&Acids" BEGIN "&Hydrochloric", 401 "&Sulfuric", 402 END ENDEND

See Also
MENU, MENUITEM
$#PUSHBOX Control
The PUSHBOX statement creates a push-box control, which is identical to a PUSHBUTTON, except that it does not display a button face or frame; only the text appears.
Syntax
PUSHBOX text, id, x, y, width, height [[, style [[, extended-style]]]]
Parameters
style
Specifies styles for the pushbox, which can be a combination of the BS_PUSHBOX style and the following styles: WS_TABS TOP, W S_DISAB LED, and WS_GROUP.
The default style is BS_PUSHBOX and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.
See Also
PUSHBUTTON
$#PUSHBUTTON Control
The PUSHBUTTON statement creates a push-button control. The control is a round-cornered rectangle containing the given text. The text is centered in the control. The control sends a message to its parent whenever the user chooses the control.
Syntax
PUSHBUTTON text, id, x, y, width, height [[, style [[, extended-style]]]]
Parameters
style
Specifies styles for the pushbutton, which can be a combination of the BS_PUSHBUTTON style and the following styles: WS_TA BST OP, WS_DISABLED, and WS_GROUP.
The default style is BS_PUSHBUTTON and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.
Example
The following example demonstrates the use of the PUSHBUTTON statement:
PUSHBUTTON "ON", 7, 10, 10, 20, 10

See Also
GetDialogBaseUnits
$#RADIOBUTTON Control
The RADIOBUTTON statement creates a radio-button control. The control is a small circle that has the given text displayed next to it, typically to its right. The control highlights the circle and sends a message to its parent window when the user selects the button. The control removes the highlight and sends a message when the button is next selected.
Syntax
RADIOBUTTON text, id, x, y, width, height [[, style [[, extended-style]]]]
Parameters
style
Specifies styles for the radio button, which can be a combination of BUTTON-class styles and the following styles: W S_TA BST OP, WS_DIS ABLED, and WS_GROUP.
The default style for RADIOBUTTON is BS_RADIOBUTTON and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.
Example
The following example demonstrates the use of the RADIOBUTTON statement:
RADIOBUTTON "Italic", 100, 10, 10, 40, 10
See Also
GetDialogBaseUnits
$#RCDATA Resource {bmc bm00.BMP} {bmc bm10.BMP}
The RCDATA statement defines a raw data resource for an application. Raw data resources permit the inclusion of binary data directly in the executable file.
Syntax
nameID RCDATA [[load-mem]][[optional-statements]]BEGIN raw-data . . .END
Parameters
nameID
Specifies either a unique name or a 16-bit unsigned integer value that identifies the resource.
load-mem
Specifies loading and memory attributes for the resource. For more information, see Common Resource Attributes.
optional-statements
Zero or more of the following statements:
Statement Description
CHARACTERISTICS dword User-defined information about a resource that can be used by tools that read and write resource files.
LANGUAGE language, sublanguage Specifies the lan
guage for the resource. The parameters are constants from WINNT.H.
VERSION dword User-defined version number for the resource that can be used by tools that read and write resource files.

raw-data
Specifies raw data consisting of one or more integers or strings of characters. Integers can be specified in decimal, octal, or hexadecimal format. To be compatible with Windows 3.1, inte
gers are stored as WORD values. You can store an integer as a DWORD value by qualifying the integer with the L suffix.
Strings are enclosed in quotation marks. RC does not automatically append a terminating null character to a string. Each string is a sequence of the specified ANSI characters, unless you qualify it as a wide-character string with the L prefix.
The block of data begins on a DWORD boundary and RC performs no padding or alignment of data within the raw-data block. It is the programmer's responsibility to ensure the proper alignment of data within the block.

Example
The following example demonstrates the use of the RCDATA statement:
resname RCDATABEGIN "Here is an ANSI string\0", /* explicitly null-terminated */
L"Here is a Unicode string\0", /* explicitly null-terminated */ 1024, /* integer, stored as WORD */ 7L, /* integer, stored as DWORD */ 0x029a, /* hex integer */ 0o733, /* octal integer */END

See Also
ACCELERATORS, CHARACTERISTICS, DIALOG, LANGUAGE, MENU, STRINGTABLE, VERSION
$#RTEXT Control
The RTEXT statement creates a right-aligned text control. The control is a simple rectangle displaying the given text right-aligned in the rectangle. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line.
Syntax
RTEXT text, id, x, y, width, height [[, style [[, extended-style]]]]
Parameters
style
Specifies styles for the text control, which can be any combination of the following: WS_TABSTOP and WS_GROUP.
The default style fo r RT EXT is SS_RIG HT and WS_GROUP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.
Example
The following example demonstrates the use of the RTEXT statement:
RTEXT "Number of Messages", 4, 30, 50, 100, 10

See Also
CONTROL, CTEXT, DIALOG, LTEXT
$#SCROLLBAR Control
The SCROLLBAR statement creates a scroll-bar control. The control is a rectangle that contains a scroll box and has direction arrows at both ends. The scroll-bar control sends a notification message to its parent whenever the user clicks the mouse in the control. The parent is responsible for updating the scroll-box position. Scroll-bar controls can be positioned anywhere in a window and used whenever needed to provide scrolling input.
Syntax
SCROLLBAR text, id, x, y, width, height [[, style [[, extended-style]]]]
Parameters
style
Specifies a combination (or none) of the following styles: WS_TABSTOP, WS_GROUP, and WS_DISABLED.
In addition to these styles, the s tyle pa ram eter ma y contain a combination (or none) of the SCROLLBAR-class styles. The default style for SCROLLBAR is SBS_HORZ.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.
Example
The following example demonstrates the use of the SCROLLBAR statement:
SCROLLBAR 999, 25, 30, 10, 100

$#STATE3 Control
The STATE3 statement defines a three-state check box control. The control is identical to a CHECKBOX, except that it has three states: checked, unchecked, and disabled (grayed).
Syntax
STATE3 text, id, x, y, width, height [[, style [[, extended-style]]]]
Parameters
text
Specifies text that is displayed to the right of the control.
style
Specifies the control styles. This value can be a combination of t he b utt on class s tyle BS_3STATE and the WS_TABSTOP and WS_GROUP styles.
If you do not specify a style, the default style is BS_3STATE and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see Common Control Parameters.
See Also
AUTOCHECKBOX, CHECKBOX, CONTROL
$#STRINGTABLE Resource {bmc bm00.BMP} {bmc bm10.BMP}
The STRINGTABLE statement defines one or more string resources for an application. String resources are simply null-terminated Unicode strings that can be loaded when needed from the executable file, using the LoadString function.
Syntax
STRINGTABLE [[load-mem]][[optional-statements]]BEGIN stringID string . . .END
Parameter
load-mem
Specifies loading and memory attributes for the resource. For more information, see Common Resource Attributes.
optional-statements
Zero or more of the following statements:
Statement Description
CHARACTERISTICS dword User-defined information about a resource that can be used by tools that read and write resource files.
LANGUAGE language, sublanguage Specifies the language for the re
source. The parameters are constants from WINNT.H.
VERSION dword User-defined version number for the resource that can be used by tools that read and write resource files.

stringID
Specifies an unsigned 16-bit integer that identifies the resource.
string
Specifies one or more strings, enclosed in double quotation marks. The string must be no longer than 4097 characters and must occ
upy a single line in the source file. To add a carriage return to the string, use this character sequence: \012. For example, "Line one\012Line two" would define a string that would be displayed as follows:
Line oneLine two

Remarks
Grouping strings in separate sections allows all related strings to be read in at one time and discarded together. When possible, an application should make the table movable and discardable. RC allocates 16 strings per section and uses the identifier value to determine which section is to contain the string. Strings with the same upper-12 bits in their identifiers are placed in the same section.
Example
The following example demonstrates the use of the STRINGTABLE statement:
#define IDS_HELLO 1#define IDS_GOODBYE 2STRINGTABLEBEGIN IDS_HELLO, "Hello" IDS_GOODBYE, "Goodbye"END

See Also
LoadString, ACCELERATORS, CHARACTERISTICS, DIALOG, LANGUAGE, MENU, RCDATA, VERSION
$#STYLE Statement
The STYLE statement defines the window style of the dialog box. The window style specifies whether the box is a pop-up or a child window. The default style has the following attributes: WS_POPUP, WS_BORDER, and WS_SYSMENU.
Syntax
STYLE style
Parameter
style
Specifies the window style. This parameter takes an integer value or redefined name. The following lists the redefined styles:
DS_LOCALEDIT
Specifies that edit controls in the dialog box will use memory in the application's data section. By default, all edit controls in dialog boxes use memory outside the application's data section. This feature can be suppressed by adding the DS_LOCALEDIT flag to the STYLE command for the dialog box. If this flag is not used, EM_GETHANDLE and EM_SETHANDLE messages must not be used since the storage for the control is not in the application's data section. This feature does not affect edit controls created outside of dialog boxes.
DS_MODALFRAME
Creates a dialog box with a modal dialog box frame that can be combined with a title bar and System menu by specifying the WS_CAPTION and WS_SYSMENU styles.
DS_NOIDLEMSG
Suppresses WM_ENTERIDLE messages that Windows would otherwise send to the owner of the dialog box while the dialog box is displayed.
DS_SYSMODAL
Creates a system-modal dialog box.
WS_BORDER
Creates a window that has a border.
WS_CAPTION
Creates a window that has a title bar (implies the WS_BORDER style).
WS_CHILD
Creates a child window. It cannot be used with the WS_POPUP style.
WS_CHILDWINDOW
Creates a child window that has the WS_CHILD style.
WS_CLIPCHILDREN
Excludes the area occupied by child windows when drawing within the parent window. Used when creating the parent window.
WS_CLIPSIBLINGS
Clips child windows relative to each other; that is, when a particular child window receives a WM_PAINT message, this style clips all other top-level child windows out of the region of the child window to be updated. (If the WS_CLIPSIBLINGS style is not given and child windows overlap, it is possible, when drawing in the client area of a child window, to draw in the client area of a neighboring child window.) For use with the WS_CHILD style only.
WS_DISABLED
Creates a window that is initially disabled.
WS_DLGFRAME
Creates a window with a modal dialog box frame but no title.
WS_GROUP
Specifies the first control of a group of controls in which the user can move from one control to the next by using the arrow keys. All controls defined with the WS_GROUP style after the first control belong to the same group. The next control with the WS_GROUP style ends the style group and starts the next group (that is, one group ends where the next begins). This style is valid only for controls.
WS_HSCROLL
Creates a window that has a horizontal scroll bar.
WS_ICONIC
Creates a window that is initially iconic. For use with the WS_OVERLAPPED style only.
WS_MAXIMIZE
Creates a window of maximum size.
WS_MAXIMIZEBOX
Creates a window that has a Maximize box.
WS_MINIMIZE
Creates a window of minimum size.
WS_MINIMIZEBOX
Creates a window that has a Minimize box.
WS_OVERLAPPED
Creates an overlapped window. An overlapped window has a caption and a border.
WS_OVERLAPPEDWINDOW
Creates an overlapped window having the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles.
WS_POPUP
Creates a pop-up window. It cannot be used with the WS_CHILD style.
WS_POPUPWINDOW
Creates a pop-up window that has the WS_POPUP, WS_BORDER, and WS_SYSMENU styles. The WS_CAPTION style must be combined with the WS_POPUPWINDOW style to make the System menu visible.
WS_SIZEBOX
Creates a window that has a size box. Used only for windows with a title bar or with vertical and horizontal scroll bars.
WS_SYSMENU
Creates a window that has a System-menu box in its title bar. Used only for windows with title bars. If used with a child window, this style creates a Close box instead of a System-menu box.
WS_TABSTOP
Specifies one of any number of controls through which the user can move by using the TAB key. The TAB key moves the user to the next control specified by the WS_TABSTOP style. This style is valid only for controls.
WS_THICKFRAME
Creates a window with a thick frame that can be used to size the window.
WS_VISIBLE
Creates a window that is initially visible. This applies to overlapping and pop-up windows. For overlapping windows, the y parameter is used as a parameter for the ShowWindow function.
WS_VSCROLL
Creates a window that has a vertical scroll bar.

Remarks
If the redefined names are used, you must include WINDOWS.H.
$#User-Defined Resource
A user-defined resource statement specifies a resource that contains application-specific data. The data can have any format and can be defined either as the content of a given file (if the filename parameter is given) or as a series of numbers and strings (if the raw-data block is given).
Syntax
nameID typeID [[load-mem]] filename
The filename specifies the name of a file containing the binary data of the resource. The contents of the file are included as the resource. RC does not interpret the binary data in any way. It is the programmer's responsibility to ensure that the data is properly aligned for the target computer architecture.
A user-defined resource can also be defined completely in the resource script using the syntax:
nameID typeID [[load-mem]]BEGIN raw-dataEND
Parameters
nameID
Specifies either a unique name or a 16-bit unsigned integer that identifies the resource.
typeID
Specifies either a unique name or a 16-bit unsigned integer that identifies the resource type. If a number i s given, it must be greater than 255. The numbers 1 through 255 are reserved for existing and future redefined resource types.
load-mem
Specifies loading and memory attributes for the resource. For more information, see Common Resource Attributes.
filename
Specifies the name of the file that contains the resource data. The parameter must be a valid filename; it must be a full path if the file is not in the current working directory.
raw-data
Specifies raw data consisting of one or more integers or strings of characters. Integers can be specified in decimal, octal, or hexadecimal format. To be compatible with Windows 3.1, integers are stored as WORD values. You can store an integer as a DWORD value by qualifying the integer with the L suffix.
Strings are enclosed in quotation marks. RC does not automatically append a terminating null character to a string. Each string is a sequence of the specified ANSI characters, unless you qualify it as a wide-character string with the L prefix.
The block of data begins on a DWORD boundary and RC performs no padding or alignment of data within the raw-data block. It is the programmer's responsibility to ensure the proper alignment of data within the block.

Example
The following example shows several user-defined statements:
array MYRES data.res14 300 custom.res18 MYRES2BEGIN "Here is an ANSI string\0", /* explicitly null-terminated */
L"Here is a Unicode string\0", /* explicitly null-terminated */ 1024, /* integer, stored as WORD */ 7L, /* integer, stored as DWORD */ 0x029a, /* hex integer */ 0o733, /* octal integer */END

$#VERSION Statement
The VERSION statement allows the developer to specify version information about a resource that can be used by tools that read and write resource files. The specified dword value appears with the resource in the compiled .RES file. However, the value is not stored in the executable file and has no significance to Windows.
The VERSION statement appears before the BEGIN in an ACCELERATORS, DIALOG, MENU, RCDATA, or STRINGTABLE resource definition. The specified value applies only to that resource.
Syntax
VERSION dword
Parameter
dword
A user-defined doubleword value.

See Also
ACCELERATORS, CHARACTERISTICS, DIALOG, LANGUAGE, MENU, RCDATA, STRINGTABLE
$#VERSIONINFO Resource
The VERSIONINFO statement creates a version-information resource. The resource contains such information about the file as its version number, its intended operating system, and its original filename. The resource is intended to be used with the File Installation library functions.
Syntax
versionID VERSIONINFO fixed-infoBEGIN block-statement . . .END
Parameters
versionID
Specifies the version-information resource identifier. This value must be 1.
fixed-info
Specifies the version information, such as the file version and the intended operating system. This parameter consists of the following statements:
FILEVERSION version
Specifies the binary version number for the file. The version consists of two 32-bit integers, defined by four 16-bit integers. For example, "FILEVERSION 3,10,0,61" is translated into two doublewords: 0x0003000a and 0x0000003d, in that order. Therefore, if version is defined by the doublewords dw1 and dw2, they need to appear in the FILEVERSION statement as follows: HIWORD(dw1), LOWORD(dw1), HIWORD(dw2), LOWORD(dw2).
PRODUCTVERSION version
Specifies the binary version number for the product with which the file is distributed. The version parameter is two 32-bit integers, defined by four 16-bit integers. For more information about version, see the FILEVERSION description.
FILEFLAGSMASK fileflagsmask
Specifies which bits in the FILEFLAGS statement are valid. If a bit is set, the corresponding bit in FILEFLAGS is valid.
FILEFLAGS fileflags
Specifies the Boolean attributes of the file. The fileflags parameter must be the combination of all the file flags that are valid at compile time. For Windows 3.1, this value is 0x3f.
FILEOS fileos
Specifies the operating system for which this file was designed. The fileos parameter can be one of the operating system values given in the Comments section.
FILETYPE filetype
Specifies the general type of file. The filetype parameter can be one of the file type values listed in the Comments section.
FILESUBTYPE subtype
Specifies the function of the file. The subtype parameter is zero unless the type parameter in the FILETYPE statement is VFT_DRV, VFT_FONT, or VFT_VXD. For a list of file subtype values, see the Comments section.
block-statement
Specifies one or more version-information blocks. A block can contain string information or variable information.

Remarks
To use the constants specified with the VERSIONINFO statement, the WINVER.H file (included in WINDOWS.H) must be included in the resource-definition file.
The following list describes the parameters used in the VERSIONINFO statement:
fileflags
Specifies a combination of the following values:
VS_FF_DEBUG
File contains debugging information or is compiled with debugging features enabled.
VS_FF_INFOINFERRED
File contains a dynamically created version-information resource. Some of the blocks for the resource may be empty or incorrect. This value is not intended to be used in version-information resources created by using the VERSIONINFO statement.
VS_FF_PATCHED
File has been modified and is not identical to the original shipping file of the same version number.
VS_FF_PRERELEASE
File is a development version, not a commercially released product.
VS_FF_PRIVATEBUILD
File was not built using standard release procedures. If this value is given, the StringFileInfo block must contain a PrivateBuild string.
VS_FF_SPECIALBUILD
File was built by the original company using standard release procedures but is a variation of the standard file of the same version number. If this value is given, the StringFileInfo block must contain a SpecialBuild string.
fileos
Specifies one of the following values:
Value Description
VOS_UNKNOWN Operating system for which the file was designed is unknown to Windows.
VOS_DOS File was designed for MS-DOS.
VOS_NT File was designed for Windows NT.
VOS_WINDOWS16 File was designed for Windows version 3.0 o
r later.
VOS_WINDOWS32 File was designed for 32-bit Windows.
VOS_DOS_WINDOWS16 File was designed for Windows version 3.0 or later running with MS-DOS.
VOS_DOS_WINDOWS32 File was designed for 32-bit Windows running with MS-DOS.
VOS_NT_WINDOWS32 File was designed for 32-bit Windows running with Windows NT.

The values 0x00002L, 0x00003L, 0x20000L and 0x30000L are reserved.
filetype
Specifies one of the following values:
Value Description
VFT_UNKNOWN File type is unknown to Windows.
VFT_APP File contains an application.
VFT_DLL File contains
a dynamic-link library (DLL).
VFT_DRV File contains a device driver. If the dwFileType member is VFT_DRV, the dwFil
eSubtype member contains a more specific description of the driver.
VFT_FONT File contains a font. If the dwFileType member is VFT_FONT, the dwFileSubtype member contains a more specific description of the font.
VFT_VXD File contains a virtual device.
VFT_STATIC_LIB File contains a static-link library.

All other values are reserved for use by Microsoft.
subtype
Specifies additional information about the file type.
If the FILETYPE statement specifies VFT_DRV, this parameter can be one of the following values:
Value Description
VFT2_UNKNOW
N Driver type is unknown to Windows.
VFT2_DRV_COMM File contains a communications driver.
VFT2_DRV_PRINTER File contains a printer driver.
VFT2_DRV_KEYBOARD File contains a keyboard driver.
VFT2_DRV_LANGUAGE File contains a language driver.
VFT2_DRV_DISPLAY File contains a display driver.
VFT2_DRV_MOUSE File contains a mouse driver.
VFT2_DRV_NETWORK File contains a network driver.
VFT2_DRV_SYSTEM File contains a system driver.
VFT2_DRV_INSTALLABLE File contains an installable driver.
VFT2_DRV_SOUND File contains a sound driver.

If the FILETYPE statement specifies VFT_FONT, this parameter can be one of the following values:
Value Description
VFT2_UNKNOWN Font type is unknown to Windows.
VFT2_FONT_RASTER File contains a raster font.
VFT2_FONT_VECTOR File contains a vector font.
VFT2_FONT_TRUETYPE File contains a TrueType font.

If the FILETYPE statement specifies VFT_VXD, this parameter must be the virtual-device identifier included in the virtual-device control block.
All subtype values not listed here are reserved for use by Microsoft.
langID
Specifies one of the following language codes:
Code Language Code Language
0x0401 Arabic 0x0415 Polish
0x0402 Bulgarian 0x0416 Brazilian Portuguese
0x0403 Catalan 0x0417 Rhaeto-Romanic
0x0404 Traditional Chinese 0x0418 Romanian
0x0405 Czech 0x0419 Russian
0x0406 Danish 0x041A Croato
-Serbian (Latin)
0x0407 German 0x041B Slovak
0x0408 Greek 0x041C Albanian
0x0409 U.S. English 0x041D Swedish
0x040A Castilian Spanish 0x041E Thai
0x040B Finnish 0x041F Turkish
0x040C French 0x0420 Urdu
0x040D Hebrew 0x0421 Bahasa
0x040E Hungarian 0x0804 Simplified Chinese
0x040F Icelandic 0x0807 Swiss German
0x0410 Italian 0x0809 U.K. English
0x0411 Japanese 0x080A Mexican Spanish
0x0412 Korean 0x080C Belgian French
0x0413 Dutch 0x0C0C Canadian French
0x0414 Norwegian - Bokml 0x100C Swiss French
0x0810 Swiss Italian 0x0816 Portuguese
0x0813 Belgian Dutch 0x081A Serbo-Croatian (Cyrillic)
0x0814 Norwegian - Nynorsk

charsetID
Specifies one of the following character-set identifiers:
Identifier Character Set
0 7-bit ASCII
932 Windows, Japan (Shift - JIS X-0208)
949 Windows, Korea (Shift - KSC 5601)
950 Windows, Taiwan (GB5)
1200 Unicode
1250 Windo
ws, Latin-2 (Eastern European)
1251 Windows, Cyrillic
1252 Windows, Multilingual
1253 Windows, Greek
1254 Windows, Turkish
1255 Windows, Hebrew
1256 Windows, Arabic

string-name
Specifies one of the following redefined names:
Comments
Specifies additional information that should be displayed for diagnostic purposes.
CompanyName
Specifies the company that produced the file¾for example, "Microsoft Corporation" or "Standard Microsystems Corporation, Inc." This string is required.
FileDescription
Specifies a file description to be presented to users. This string may be displayed in a list box when the user is choosing files to install¾for example, "Keyboard Driver for AT-Style Keyboards" or "Microsoft Word for Windows". This string is required.
FileVersion
Specifies the version number of the file¾for example, "3.10" or "5.00.RC2". This string is required.
InternalName
Specifies the internal name of the file, if one exists¾for example, a module name if the file is a dynamic-link library. If the file has no internal name, this string should be the original filename, without extension. This string is required.
LegalCopyright
Specifies all copyright notices that apply to the file. This should include the full text of all notices, legal symbols, copyright dates, and so on¾for example, "Copyright© Microsoft Corporation 1990-1992". This string is optional.
LegalTrademarks
Specifies all trademarks and registered trademarks that apply to the file. This should include the full text of all notices, legal symbols, trademark numbers, and so on¾for example, "Windows™ is a trademark of Microsoft® Corporation". This string is optional.
OriginalFilename
Specifies the original name of the file, not including a path. This information enables an application to determine whether a file has been renamed by a user. The format of the name depends on the file system for which the file was created. This string is required.
PrivateBuild
Specifies information about a private version of the file¾for example, "Built by TESTER1 on \TESTBED". This string should be present only if the VS_FF_PRIVATEBUILD flag is set in the dwFileFlags member of the VS_FIXEDFILEINFO structure of the root block.
ProductName
Specifies the name of the product with which the file is distributed¾for example, "Microsoft Windows". This string is required.
ProductVersion
Specifies the version of the product with which the file is distributed¾for example, "3.10" or "5.00.RC2". This string is required.
SpecialBuild
Specifies how this version of the file differs from the standard version¾for example, "Private build for TESTER1 solving mouse problems on M250 and M250E computers". This string should be present only if the VS_FF_SPECIALBUILD flag is set in the dwFileFlags member of the VS_FIXEDFILEINFO structure in the root block.

A string information block has the following form:
BLOCK "StringFileInfo"BEGIN BLOCK "lang-charset" BEGIN VALUE "string-name", "value" . . . ENDEND
Following are the parameters in the StringFileInfo block:
lang-charset
Specifies a language and character-set identifier pair. It is a hexadecimal string consi sting of the concatenation of the langu age and cha ract er-se t identifiers listed earlier in this section.
string-name
Specifies the name of a value in the block and can be one of the redefined names listed earlier in this section.
value
Specifies, as a character string, the value of the corresponding string name. More than one VALUE statement can be given.

A variable information block has the following form:
BLOCK "VarFileInfo"BEGIN VALUE "Translation", langID, charsetID . . .END
Following are the parameters in the variable information block:
langID
Specifies one of the language identifiers listed earlier in this section.
charsetID
Specifies one of the character-set identifiers listed earlier in t his section. More than one identifier pair can be given, but each pair must be separated from the preceding pair with a comma.

$#Preprocessor Directives Reference
The syntax and semantics for the RC preprocessor are the same as for the preprocessor in a C compiler. Single-line comments begin with two forward slashes (//) and run to the end of the line. Block comments begin with an opening delimiter (/*) and run to a closing delimiter (*/). Comments do not nest.
You use the #define directive to define symbols for your resource identifiers in a header file. You include this header both in the resource script and your application source code. Similarly, the values for attributes and styles are defined by including the C header files for Windows.
You can also define macros. The standard C preprocessing operators (#, ##) can be used in a macro definition. For detailed information on preprocessing and defining macros, see your C compiler documentation.
The rest of this section describes the preprocessing directives.
$##define {bmc bm00.BMP} {bmc bm10.BMP}
The #define directive assigns the given value to the specified name. All subsequent occurrences of the name are replaced by the value.
Syntax
#define name value
Parameters
name
Specifies the name to be defined. This value is any combination of letters, digits, and punctuation.
value
Specifies any integer, character string, or line of text.

Example
This example assigns values to the names "NONZERO" and "USERCLASS":
#define NONZERO 1#define USERCLASS "MyControlClass"

See Also
#ifdef, #ifndef, #undef
$##elif {bmc bm00.BMP} {bmc bm10.BMP}
The #elif directive marks an optional clause of a conditional-compilation block defined by a #ifdef, #ifndef, or #if directive. The directive controls conditional compilation of the resource file by checking the specified constant expression. If the constant expression is nonzero, #elif directs the compiler to continue processing statements up to the next #endif, #else, or #elif directive and then skip to the statement after #endif. If the constant expression is zero, #elif directs the compiler to skip to the next #endif, #else, or #elif directive. You can use any number of #elif directives in a conditional block.
Syntax
#elif constant-expression
Parameter
constant-expression
Specifies the expression to be checked. This value is a defined name, an integer constant, or an expression consisting of names, integers, and arithmetic and relational operators.

Example
In this example, #elif directs the compiler to process the second BITMAP statement only if the value assigned to the name "Version" is less than 7. The #elif directive itself is processed only if Version is greater than or equal to 3.
#if Version < 3BITMAP 1 errbox.bmp#elif Version < 7BITMAP 1 userbox.bmp#endif

See Also
#else, #endif, #if, #ifdef, #ifndef
$##else {bmc bm00.BMP} {bmc bm10.BMP}
The #else directive marks an optional clause of a conditional-compilation block defined by a #ifdef, #ifndef, or #if directive. The #else directive must be the last directive before the #endif directive.
This directive has no arguments.
Syntax
#else
Example
This example compiles the second BITMAP statement only if the name "DEBUG" is not defined:
#ifdef DEBUG BITMAP 1 errbox.bmp#else BITMAP 1 userbox.bmp#endif

See Also
#elif, #endif, #if, #ifdef, #ifndef
$##endif {bmc bm00.BMP} {bmc bm10.BMP}
The #endif directive marks the end of a conditional-compilation block defined by a #ifdef directive. One #endif is required for each #if, #ifdef, or #ifndef directive.
Syntax
#endif
This directive has no arguments.
See Also
#elif, #else, #if, #ifdef, #ifndef
$##if {bmc bm00.BMP} {bmc bm10.BMP}
The #if directive controls conditional compilation of the resource file by checking the specified constant expression. If the constant expression is nonzero, #if directs the compiler to continue processing statements up to the next #endif, #else, or #elif directive and then skip to the statement after the #endif directive. If the constant expression is zero, #if directs the compiler to skip to the next #endif, #else, or #elif directive.
Syntax
#if constant-expression
Parameter
constant-expression
Specifies the expression to be checked. This value is a defined name, an integer constant, or an expression consisting of names, integers, and arithmetic and relational operators.

Example
This example compiles the BITMAP statement only if the value assigned to the name "Version" is less than 3:
#if Version < 3BITMAP 1 errbox.bmp#endif

See Also
#elif, #else, #endif, #ifdef, #ifndef
$##ifdef {bmc bm00.BMP} {bmc bm10.BMP}
The #ifdef directive controls conditional compilation of the resource file by checking the specified name. If the name has been defined by using a #define directive or by using the /d command-line option with the resource compiler, #ifdef directs the compiler to continue with the statement immediately after the #ifdef directive. If the name has not been defined, #ifdef directs the compiler to skip all statements up to the next #endif directive.
Syntax
#ifdef name
Parameter
name
Specifies the name to be checked by the directive.

Example
This example compiles the BITMAP statement only if the name "Debug" is defined:
#ifdef DebugBITMAP 1 errbox.bmp#endif

See Also
#define, #endif, #if, #ifndef, #undef
$##ifndef {bmc bm00.BMP} {bmc bm10.BMP}
The #ifndef directive controls conditional compilation of the resource file by checking the specified name. If the name has not been defined or if its definition has been removed by using the #undef directive, #ifndef directs the compiler to continue processing statements up to the next #endif, #else, or #elif directive and then skip to the statement after the #endif directive. If the name is defined, #ifndef directs the compiler to skip to the next #endif, #else, or #elif directive.
Syntax
#ifndef name
Parameter
name
Specifies the name to be checked by the directive.

Example
This example compiles the BITMAP statement only if the name "Optimize" is not defined:
#ifndef OptimizeBITMAP 1 errbox.bmp#endif

See Also
#elif, #else, #endif, #if, #ifdef, #undef
$##include {bmc bm00.BMP} {bmc bm10.BMP}
The #include directive causes resource compiler to process the file specified in the filename parameter. This file should be a header file that defines the constants used in the resource-definition file. Use the statement
#ifndef RC_INVOKED

in your header file to surround statements that can be compiled by a C compiler but not RC. This way, you can use the same include files in your .C and .RC files.
Syntax
#include filename
Parameter
filename
Specifies the name of the file to be included. If the file is in the current directory, the string must be enclosed in double quotation marks; if the file is in the directory specified by the INCLUDE environment variable, the string must be enclosed in less-than and greater-than characters (<>). You must give a full path enclosed in double quotation marks (") if the file is not in the current directory or in the directory specified by the INCLUDE environment variable.

Example
This example processes the header files WINDOWS.H and HEADERS\MYDEFS.H while compiling the resource-definition file:
#include <windows.h>#include "headers\mydefs.h"

See Also
#define
$##undef {bmc bm00.BMP} {bmc bm10.BMP}
The #undef directive removes the current definition of the specified name. All subsequent occurrences of the name are processed without replacement.
Syntax
#undef name
Parameter
name
Specifies the name to be removed. This value is any combination of letters, digits, and punctuation.

Example
This example removes the definitions for the names "nonzero" and "USERCLASS":
#undef nonzero#undef USERCLASS

See Also
#define
$#RC Diagnostic Messages Reference
This section describes of diagnostic messages produced by RC. Many of these messages appear when RC is not able to compile resources properly. The descriptions clarify the cause of each message. The messages are listed in alphabetic order.
A capital V in parentheses (V) at the beginning of a message description indicates that the message is displayed only if RC is run with the /v (verbose) option. These messages are generally informative and do not necessarily indicate errors.
$#A
Accelerator Type required (ASCII or VIRTKEY)
The type parameter in the ACCELERATORS statement must contain either the ASCII or VIRTKEY value.
$#B
BEGIN expected in Accelerator Table
An ACCELERATORS statement was not followed by the BEGIN keyword.
BEGIN expected in Dialog
A DIALOG statement was not followed by the BEGIN keyword.
BEGIN expected in menu
A MENU statement was not followed by the BEGIN keyword.
BEGIN expected in RCData
An RCDATA statement was not followed by the BEGIN keyword.
BEGIN expected in String Table
A STRINGTABLE statement was not followed by the BEGIN keyword.
BEGIN expected in VERSIONINFO resource
A VERSIONINFO statement was not followed by the BEGIN keyword.
Bitmap file resource-file is not in version-number format.
Use Microsoft Image Editor (IMAGEDIT.EXE) to convert old resource files to the current format.
$#C
Cannot Re-use String Constants
You are using the same value twice in a STRINGTABLE statement. Make sure that you have not mixed overlapping decimal and hexadecimal values.
Contr ol Character out of range [A - Z]
A control character in the ACCELERATORS statement is invalid. The character following the caret (^) must be in the range A through Z.
Could not open in-file-name
Microsoft Windows Resource Compiler (RC) could not open the specified file. Make sure that the file exists and that you typed the filename correctly.
Couldn't open resource-name
Microsoft Windows Resource Compiler (RC) could not open the specified file. Make sure that the file exists and that you typed the filename correctly.
Creating resource-name
(V) Microsoft Windows Resource Compiler (RC) is creating a new binary resource (.RES) file.
$#E
Emp ty menus not allowed
An END keyword appears before any menu items are defined in the MENU statement. Empty menus are not permitted by Microsoft Windows Resource Compiler (RC). Make sure that you do not have any opening quotation marks within the MENU statement.
END expected in Dialog
The END keyword must appear at the end of a DIALOG statement. Make sure that there are no opening quotation marks left from the preceding statement.
END expected in menu
The END keyword must appear at the end of a MENU statement. Make sure that there are no mismatched BEGIN and END statements.
Error Creating resource-name
Microsoft Windows Resource Compiler (RC) could not create the specified binary resource (.RES) file. Make sure that it is not being created on a read-only drive. Use the /voption to find out whether the file is being created.
Expected Comma in Accelerator Table
Microsoft W indows Resource Compiler (RC) requires a comma between the event and idvalue parameters in the ACCELERATORS statement.
Expected control class name
The class parameter of a CONTROL statement in the DIALOG statement must be one of the following control types: BUTTON, COMBOBOX, EDIT, LISTBOX, SCROLLBAR, STATIC, or user-defined. Make sure that the class is spelled correctly.
Expected font face name
The typeface parameter of the FONT statement in the DIALOG statement must be a character string enclosed in double quotation marks ("). This parameter specifies the name of a font.
Expected ID value for Menuitem
The MENU statement must contain a MENUITEM statement, which has either an integer or a symbolic constant in the MenuID parameter.
Expected Menu String
Each MENUITEM and POPUP statement must contain a text parameter. This parameter is a string enclosed in double quotation marks (") that specifies the name of the menu item or pop-up menu. A MENUITEM SEPARATOR statement requires no quoted string.
Expected numeric command value
Microsoft Windows Resource Compiler (RC) was expecting a numeric idvalue parameter in the ACCELERATORS statement. Make sure that you have used a #define constant to specify the value and that the constant used is spelled correctly.
Expected numeric constant in string table
A numeric constant, defined in a #define statement, must immediately follow the BEGIN keyword in a STRINGTABLE statement.
Expected numeric point size
The pointsize parameter of the FONT statement in the DIALOG statement must be an integer point-size value.
Expected Numerical Dialog constant
A DIALOG statement requires integer values for the x, y, width, and height parameters. Make sure that these values, which are included after the DIALOG keyword, are not negative.
Expected String in STRINGTABLE
A string is expected after each numeric stringid parameter in a STRINGTABLE statement.
Expected String or Constant Accelerator command
Microsoft Windows Resource Compiler (RC) was not able to determine which key was being set up for the accelerator. The event parameter in the ACCELERATORS statement might be invalid.
Expected VALUE, BLOCK, or END keyword.
The VERSIONINFO structure requires a VALUE, BLOCK, or END keyword.
Expecting number for ID
A number is expected for the id parameter of a CONTROL statement in the DIALOG statement. Make sure that you have a number or a #define statement for the control identifier.
Expecting quoted string for key
The key string following the BLOCK or VALUE keyword should be enclosed in double quotation marks.
Expecting quoted string in dialog class
The class parameter of the CLASS statement in the DIALOG statement must be an integer or a string enclosed in double quotation marks (").
Expecting quoted string in dialog title
The captiontext parameter of the CAPTION statement in the DIALOG statement must be a character string, enclosed in double quotation marks (").
$#F
File not found: filename
The file specified in the rc command was not found. Make sure that the file has not been moved to another directory and that the filename or path is typed correctly.
Font names must be ordinals
The pointsize parameter in the FONT statement must be an integer, not a string.
$#I
I nvalid Accelerator
An event parameter in the ACCELERATORS statement was not recognized or was more than two characters long.
Invalid Accelerator Type (ASCII or VIRTKEY)
The type parameter in the ACCELERATORS statement must contain either the ASCII or VIRTKEY value.
Invalid control character
A control character in the ACCELERATORS statement is invalid. A valid control character consists of a caret (^) followed by a single letter.
Invalid Control type
The CONTROL statement in a DIALOG statement must be one of the following: AUTO3STATE, AUTOCHECKBOX, AUTORADIOBUTTON, CHECKBOX, COMBOBOX, CONTROL, CTEXT, DEFPUSHBUTTON, EDITTEXT, GROUPBOX, ICON, LISTBOX, LTEXT, PUSHBOX, PUSHBUTTON, RADIOBUTTON, RTEXT, SCROLLBAR, STATE3.
Invalid directive in preprocessed RC file
The specified filename has an embedded newline character.
Invalid .EXE file
The executable (.EXE) file is invalid. Make sure that the linker created it correctly and that the file exists.
Invalid switch, option
An option used was invalid. For a list of the command-line options, use the rc /? command.
Invalid switch, too many -D switches
Too many -d options were specified. To define a large number of symbols, use the #include directive to include a file of definitions.
Invalid type
The res ource type was not among the types defined in the include file.
Invalid usage. Use RC -? for Help
Make sure that you have at least one filename to work with. For a list of the command-line options, use the rc -? command.
I/O error reading file
Read failed. Since this is a generic routine, no specific filename is supplied.
I/O error seeking in file
Seeking in file failed. Since this is a generic routine, no specific filename is supplied.
I/O error writing file
Write failed. Since this is a generic routine, no specific filename is supplied.
$#N
No resource binary filename specified.
The /fo option was used, but no binary resource (.RES) file was specified.
$#O
Old DIB in resource-name. Pass it through IMAGEDIT.
The resource file specified is not compatible with Win32. Make sure you have read and saved this file using the latest version of Microsoft Image Editor (IMAGEDIT.EXE).
Out of heap memory
There was not enough memory.
Out of memory, needed n bytes
Mic rosoft Window s Resource Compiler (RC) was not able to allocate the specified amount of memory.
$#R
Redefinition of Button Type
The specified button styles conflict with or modify the style specified by the control keyword. This is a warning only and may be ignored.
The following c ommon method of declaring an automatic radio button generates this warning:
RADIOBUTTON "&Italic", MYRB_ITALIC, 10, 10, 30, 12, BS_AUTORADIOBUTTON

To avoid the warning, use the control statement appropriate for the type of button that you want to define. In this example, the corrected statement is:
AUTORADIOBUTTON "&Italic", MYRB_ITALIC, 10, 10, 30, 12

RC: Invalid switch: option
An option used was invalid. For a list of the command-line options, use the rc /? command.
RC: RCPP.ERR not found
The RCPP.ERR file must be in the current directory or in a directory specified in the PATH environment variable.
RC terminated by user
A CTRL+C key combination was pressed, exiting Microsoft Windows Resource Compiler (RC).
RC terminating after preprocessor errors
For information about preprocessor errors, see the documentation for the preprocessor.
Resource file resource-name is not in version-number format.
Make sure your icons and cursors have been read and saved using the latest version of Microsoft Image Editor (IMAGEDIT.EXE).
$#T
Text string or ordinal expected in Control
The text parameter of a CONTROL statement in the DIALOG statement must be either a tex t string or an ordinal re ference to the type of control that is expected. If using an ordinal, make sure that you have a #define statement for the control.
$#U
Unable to create destination
Microsoft Windows Resource Compiler (RC) was not able to create the destination file. Make sure that there is enough disk space.
Unbalanced Parentheses
Make sure that you have closed every opening parenthesis in the DIALOG statement.
Unexpected value in RCData
The values for the ra w-data parameter in the RCDATA statement must be integers or strings, separated by commas. Make sure that you did not leave out a comma or a quotation mark around a string.
Unexpected value in value data
A statement contained information with a format or size different from the expected value for that parameter.
Unknown DIB header format
The device-independent bitmap (DIB) header is not a BITMAPCOREHEADER or BITMAPINFOHEADER structure.
Unknown Menu SubType
The item-definitions parameter of the MENU statement can contain only MENUITEM and POPUP statements.
Unrecognized VERSIONINFO field; BEGIN or comma expected
The format of the information following a VERSIONINFO statement is incorrect.
$#V
Version WORDs separated by commas expected
Values in an information block for a VERSIONINFO statement should be separated by commas.
$#W
Warning: ASCII character not equivalent to virtual key code
An invalid virtual-key code exists in the ACCELERATORS statement. The ASCII values for some characters such as *, ^, or & are not equivalent to the virtual-key codes for the corresponding keys. In the case of the asterisk (*), the virtual-key code is equivalent to the ASCII value for 8, the numeric character on the same key. Therefore, the statement VIRTKEY '*' is invalid.
Warning: SHIFT or CONTROL used without VIRTKEY
The ALT, SHIFT, and CONTROL options apply only to virtual keys in the ACCELERATORS statement. Make sure that the VIRTKEY option is used with one of these other options.
Writing resource type image lang:language size:size
(V) Microsoft Windows Resource Compiler (RC) is writing the specified resource. The type is the resource type. It may be a number or a string. The image can be a number or a string. The language is the national language of the resource. The size is the decimal size of the reso urce in b ytes.


D:\COM_CHM\Documentation CHM\_API\RC Resource Compiler\RTF\Res_LCC_Compiler.rtf

-------------------------------- Vu dans LCC-WIN32.doc 7541Ko ---------------------------------------
The resource compiler
The .rc language specifications.
This language was developed to specify resource files. It describes the basic resource types, i.e.; the following objects:

  • Menus
  • Dialog boxes
  • Accelerators
  • String tables
  • Icons
  • Bitmaps
  • Cursors
  • Fonts
  • Version

Each object is introduced in the following manner:

Name or ID OBJECTNAME [Options]

For instance, to specify a Menu object, you would write:

2800 MENU Discardable

The language supposes that there is a preprocessor that allows for #defines, #if, #ifdef, etc. The specifications of the preprocessor are identical to the C preprocessor, so I will not discuss it further here.
This language is only slightly 'specified'. The specifications are actually the behavior of the Microsoft's resource compiler 'rc'. For instance, rc accepts that instead of writing a keyboard objectname, you can replace it with a number from 1 to 16, specifying a resource type in numerical form.

Parsing
Initially, I was tempted to use the public domain ‘rcl’ resource compiler developed by Gunther Ebert, in Leipzig. Gunther used the standard Unix approach of lex/yacc.

His compiler is constructed with a ‘lexer’ that is written in the ‘lex’ language specifications, and a parser, specified in the ‘yacc’ notation. The ‘lexer’ is built by a program called ‘lex’ that generates a lexer from the specifications it reads. The parser is generated by the ‘yacc’ program, that writes a parser using the specifications given in the ‘yacc’ language.

This approach is very flexible, but it had several disadvantages for the purposes of a resource compiler:

  • It is very hard to debug a ‘yacc’ specification.
  • Yacc and ‘flex’ are not readily available under Windows 32. I had to use my linux machine, to compile the lexer+parser, then use ftp to move the result to windows, and then recompile. And this for each change done to the specification.
  • It was very complicated to do apparently simple things like processing optional arguments etc.

So I decided to use the same approach as described by Fraser and Hanson in their book about lcc: the recursive descent approach.

The resulting parser was much smaller, and much easier to debug.

The parser
Parsing is done following a rather simple ‘algorithm’:
while (not EndOfFile) do {
token = readtok();
if (isAnObjectToken(token)) {
ParseObject(token);
}
}

Following are the object tokens, i.e. the tokens that introduce an object:
DIALOG MENU,ACCELERATORS STRINGTABLE VERSION BITMAP CURSOR ICON MESSAGETABLE

Simple isn’t it? The parser just ignores all input except those words. When it sees one of those, it will parse an object specification that should leave the last token untouched.

To avoid that the resource compiler sees a token in another context it #defines the following pre-processor symbol: RC_INVOKED. Most definitions in the windows header files are enclosed in a pair of ifdefs
#ifndef RC_INVOKED
typedef ...
#endif

This prevents random matches. If you use structure definitions in the header files the resource compiler will see, take care to enclose your definitions as shown. In any case, the consequences of seeing a random definition are not very bad, since it will only provoke a cascade of error messages.

The function ‘gettok() does a classification of the input passed to the parser by the preprocessor. It returns :

  • A character, i.e. a value between 32 and 127. This will be returned for commas, brackets, etc.
  • A constant between 1000 and 1999 for different classes of input, indicating whether the input is a number, an identifier, a floating point constant, a string, or other things. The value will be left in a global variable, so that the rest of the parser can use it.
  • A constant between 2000 and 3000 if the input is an rc keyword.

The top level parser function looks like this:

static int Parse(void)
{
int ttype;

ttype = gettok();
do {
switch(ttype) {
case EOI:
return(1);
case KEY_DIALOGEX:
ParseDialog(1);
break;
case KEY_DIALOG:
ParseDialog(0);
break;
// other cases omitted for brevity
}
ttype = gettok();
} while (ttype != EOI);

return(1);
}

Each of the functions called will parse the grammar for the description of the object, leaving the last token in the input. Here is the description of each one:

Dialog statement
nameID DIALOG [ load-mem] x, y, width, height[optional-statements]BEGIN control-statement . . .END

The ParseDialog() function retrieves the last integer/identifier, and uses that as the name for the dialog. Then, the ‘load-flags’ are parsed, but ignored. Those flags were very important under windows 3.1, but now they are not used. They were maintained to have a backward compatibility with the resource scripts written for windows 3.1.

The function goes on parsing the coordinates of the dialog box. After that, we arrive at the optional statements. Those can be:
FONT
  • Followed by a point size, a font name, and if it is a DIALOGEX statement, the weight of the font and an italics flag.
  • CAPTION Followed by a character string indicating the caption text.
  • CLASS statement indicating the class of the dialog. Normally this is not used.
  • CHARACTERISTICS field, followed by a 32 bit number. Windows do not use this, and the resource editor never generates it.
  • STYLE followed by the window style of the dialog box window.
  • EXSTYLE followed by the extended style of the dialog box window. This can be used only within a DIALOGEX statement, and not a normal DIALOG statement.
  • LANGUAGE followed by two numbers specifying the language and the sub-language code.
  • VERSION followed by a version number for the dialog. Windows do not use this.

  • Onc
e this preliminaries are done, we can start parsing the contents of the dialog box, the different CONTROL statements. This statements have all the same syntax, excepting the CONTROL statement.
NAME text, id, x, y, wid th, hei ght [, style [, extended-style]]

Here is a table indicating for each of the named controls, its class, default styles and usage.

NAME
Remarks Default Styles Class
GROUPBOX This statement builds a transparent rectangle to group some items into a common group BS_GROUPBOX Button
LTEXT Left aligned static text SS_LEFT Static
CTEXT Centered static text SS_CENTER Static
RTEXT Right aligned static text SS_RIGHT Static
LISTBOX Builds a listbox. Normally the ‘text’ field is empty WS_BORDER LBS_NOTIFY Listbox
EDITTEXT Builds an edit field. Normally the ‘text’ field is empty ES_LEFT WS_BORDER WS_TABSTOP Edit
ICON This creates a static text window at the position specified. Since Icons have a fixed width and height, those fields are not necessary. If you specify them, the resource compiler will read and ignore them. SS_ICON Static
PUSHBOX This creates a button with the BS_PUSHBOX style BS_PUSHBOX WS_TABSTOP Button
PUSHBUTTON This creates a normal push button. BS_PUSHBUTTON WS_TABSTOP Button
RADIOBUTTON This creates a radio button BS_RADIOBUTTON Button
SCROLLBAR Creates a scroll bar WS_TABSTOP Button
STATE3 Create a three state check box BS_3STATE Button
COMBOBOX Creates a combo box Combobox
CHECKBOX Does a check box BS_CHECKBOX WS_TABSTOP Button
AUTORADIOBUTTON Radio button with the ‘automatic’ style. BS_AUTORADIOBUTTON Button
AUTOCHECKBOX Check box with the ‘automatic’ style BS_AUTOCHECKBOX Button
DEFPUSHBUTTON This is the default button that will be used when you press return. BS_DEFPUSHBUTTON WS_TABSTOP Button

The
general Control statement has the following form:
CONTROL text, id, cla ss, sty le, x, y, wid th, hei ght [, extended-style]
All statements numbered before can be written using the ‘control’ statement. They are just shorthand’s for this one.
The ‘extended style’ can only be used if it is an extended dialog (DIALOGEX).

MENU Statement
menuID MENU [load-mem][optional-statements]BEGIN item-definitions . . .END

This statement introduces a menu description, with each of the POPUPS described within a BEGIN/END block.
The binary format generated is as follows:
Normal re
source header with type 4 (menu).
A flags word. If the flags contain the ‘POPUP’ flag (0x10) this indicates an implicit begin/end block. If not, it is a menu item. The text of the popup follows in unicode characters.
A menu item contains a flags word, followed by the ID of the menu item (the parameter you will receive when processing WM_COMMAND messages), followed by the text of the menu item in unicode characters.
The last item of the menu contains the flag 0x80 to indicate the end of the menu description.
The diffe
rent image resources (icons, bitmaps, cursors)
nameID ICON [load-mem] filename
nameID BITMAP [load-mem] filename
nameID CURSOR [load-mem] filename

The specifications for those resources are like this:

The ICON statement in the .RC script does not create a single resource object, but creates a group of resources. This allows Windows-based programs a degree of device independence through the use of different pixel bitmaps on hardware configurations with differing capabilities. Icons, most often designed for differing numbers of pixel planes and pixel counts, are grouped and treated by Windows as a single resource. In the .RES and .EXE files, however, they are stored as a group of resources. These groups are stored in a .RES file with the components first (in this case the different icons [type 3]) and a group header following (type 14). The group header contains the information necessary to allow Windows to select the proper icon to display.

The components have the following structure:
[Resource header (type = 3)]

[DIB Header]
[Color DIBits of icon XOR mask]
[Monochrome DIBits of AND mask]

I had a lot of trouble building that resource header. I think I have gotten it right now, but beware... As a test of the correctness of ‘lrc’, I used ‘weditres’, that will display the icons, and decode that resource header.

Basically, the compiler treats all of these the same: it will read a file specification, and put that file unchanged in the resource file. No magic is performed, i.e. for instance for icons, the Xor of the image is not performed to have a black and white and a color version. The compiler doesn’t generate different icons for vga, svga, and other resolutions either... SO: please edit your icons with another tool before. Of course, the resource editor will eventually have an icon editor, but this is not done yet...
The string table resource
STRINGTABLE [load-mem] [optional-statements]BEGIN stringID string . . .END

As usual, the ‘load’ flags are parsed but ignored. The optional statements can be ‘Language’, ‘Characteristics’ or ‘Version’ keywords.
The format of each string is just a numerical ID, followed by the string enclosed in quotes. The usual expansions for C character strings are performed.
Strings are clustered together in blocks of 16 strings, keyed by the numerical ID. The algorithm is rather complicated;
ID should sor
t the strings, because the linker lcclnk will not sort them when transforming the resource in object files.
Transform all strings into unicode before storing them. They are stored preceded by a word indicating the string length. They are NOT zero terminated.
Use the lower 4 bits of the id to indicate a position within a block of 16 strings with consecutive Ids.
Use the upper 12 bits of the plus one, to give a resource ID for a string resource of type 6 (string table resource type).
This means th
at if you give a string an ID that is isolated from other Ids you will waste space in the resource file, since an almost empty block containing only one string+the resource header will be stored.

Here is the essential part of the string-resource writing function:
idx = 0; // running index through the table
buffer = allocate(20000); // buffer space
bufferlen = 20000; // its length
 do {
memset(slots,0,sizeof(slots))// clean the slot
first = StringTable[idx]->id;// first index
len = 32; // 16 * sizeof(word)
// the variable ‘strings’ is the total number of strings in the table
while (idx < strings ) { // fill a slot of 16 strings
id = StringTable[lastidx]->id; // get this string id
// test if this string belongs to this block
if ((first & (~0xF)) == (id & (~0xf))) {
slots[(id&0xF)] = StringTable[lastidx];
len += 2*(StringTable[lastidx]->len);
lastidx++
;
}
else
{// this block is full
break;
 }
}
// test if the buffer is big enough
if (len > bufferlen) {
len += 500;
buffer = MyRealloc(buffer,len);
bufferlen = len;
}
// Now copy all the strings found into the output buffer
p = buffer;
for (i=0; i<16; i++) {
if (slots[i] && slots[i]->len) {
len = slots[i]->len;
p = WriteWord(p,(WORD)(len));
mbstowcs((WORD *)p,slots[i]->Text,len);
p += 2*len;
}
else p = WriteWord(p,0);
}
WriteStringResource(buffer,
p - buffer,
1+(first >> 4),
characteristics,language,version);
idx = lastidx;

} while (idx < strings);

The string table format uses two bytes for each character, plus the overhead for storing the blocks. If you want to save space, it is much more efficient and faster to use a structure with a tag and a pointer to the string, and looking up that at run time yourself. As an indication, I had the string table in resource format in earlier versions of wedit. When I translated the format into a normal C structure with ASCII characters the program shrank by 22K.

The RCDATA resource
nameID RCDATA [[load-mem]][[optional-statements]]BEGIN raw-data . . .END
This resource is not extremely difficult to do. Just parse a normal header, its type in the resource header is 10, and then read a series of strings or integers between the ‘BEGIN’ and ‘END’ keywords. A thing to be remembered is that integers, unless they end with the ‘L’ are 16 bits...
The Message Table resource
nameID MESSAGETABLE filename

This resource type is generated by the message compiler mc. This tool hasn't been added to the capabilities of lrc, so you will have to get it from another compiler. Probably the capabilities of mc will be incorporated into lrc at a later stage in development. For the time being, it is only possible to use already compiled message tables. This is used in NT service executables for instance, or in other specialized applications. The format of the binary resource is very similar to the string table resource format.

The ACCELERATORS resource
Syntax:

acctablename ACCELERATORS[optional-statements]BEGIN event, idvalue, [type] [opt ions] . . .END

The acctablename token is either a number or a name. The optional statements that lrc recognizes here is only the LANGUAGE keyword.
event
Specifies the keystroke to be used as an accelerator. It can be any one of the following character types:
"char"
A single character enclosed in double quotation marks ("). The character can be preceded by a caret (^), meaning that the character is a control character.
character
An integer value representing a character. The type parameter must be ASCII.
virtual-key character
An integer value representing a virtual key. The virtual key for alphanumeric keys can be specified by placing the uppercase letter or number in double quotation marks (for example, "9" or "C"). The type parameter must be VIRTKEY.
idvalue
Specifies a 16-bit unsigned integer value that identifies the accelerator.
type
Required only when the event parameter is a character or a virtual-key character. The type parameter specifies either ASCII or VIRTKEY; the integer value of event is interpreted accordingly. When VIRTKEY is specified and event contains a string, event must be uppercase.
options
Specifies the options that define the accelerator. This parameter can be one or more of the following values:
NOINVERT
Specifies that no top-level menu item is highlighted when the accelerator is used. This is useful when defining accelerators for actions such as scrolling that do not correspond to a menu item. If NOINVERT is omitted, a top-level menu item will be highlighted (if possible) when the accelerator is used.
ALT
Causes the accelerator to be activated only if the ALT key is down.
SHIFT
Causes the accelerator to be activated only if the SHIFT key is down.
CONTROL
Defines the character as a control character (the accelerator is only activated if the CONTROL key is down). This has the same effect as using a caret (^) before the accelerator character in the event parameter.
The ALT, SHIFT, and CONTROL options apply only to virtual keys.
Resource format
The format of the accelerators is simple: they consist of a normal resource header, followed by a table of structures like this:
typedef struct tagAccelTableEntry {
WORD fFlags;// This contains the flag fields above
WORD wAscii;// Contains the value of the accelerator
WORD wId; // Contains the value of the identifier
WORD padding; // not used
} AccelTableEntry;

The fFlags field contains the values for the qualifiers described in the 'Syntax' header above. There is one called ACC_LAST, the appears in the last member of the table. Basically, this resource consists of a normal header size, followed by the entries, each one, containing the structure above.
I always write the last empty table member, with all its members to zero, and only in the fFlags field, the value ACC_LAST, but I am not sure if this is really necessary, since the size of the table can be easily deduced from the size of the resource divided by the size of each element.

Limitations of the resource compiler
The FONT resources are not supported yet. They will be added in the future as time permits...
The same is true for the user defined resource types.

The source distribution of the resource compiler
The sources of the resource compiler are located in \lcc\src\lrc. The following files are in there :
parse.c. Main file of t
  • he resource compiler. Everything, from lexing to resource file generation is contained in this file.
  • ncpp.c. The preprocessor for the resource compiler. It is almost the same code as the same named file in the C compiler distribution. It is there because I decided to separate the modifications done to the preprocessor code from the ones in lrc, that needs much less complexity for its own modest needs.
  • The main file contains
a lexer in a very similar pattern that lcc uses. It will return an integer with the token parsed so far. The parsing routines decide how the tokens are interpreted.

The librarian
lcclib was the last utility that was missing to complete the cycle of lcc’s environment. Its task is to store several object files into one file called ‘library’, that contains the object files and three headers to describe to the linker what are the contents of each. The object files are stored without any modifications. No compression or other processing is required.
The structure is very similar to the one used under UNIX.
The signature
All archives have a signature that marks them as a library. Under win32 the signature used is
!<arch>\n
All .lib files have those 8 chars at the very beginning of the file.
The « first linker member »
After the signature, there are normally three headers. called ‘members’ in techspeak. The first one is a very simple table that tells the linker which symbol is in which object file. The name of the first linker member is "/". Its format is the following:

Offset Size Field Descri
ption
0 4 Number of Symbols Unsigned long containing the number of symbols indexed. This number is stored in big-endian format. Each object-file member typically defines one or more external symbols.
4 4*n Offsets Array of file offsets to archive member headers, in which n is equal to Number of Symbols. Each number in the array is an unsigned long stored in big-endian format. For each symbol named in the String Table, the corresponding element in the Offsets array gives the location of the archive member that contains the symbol.
* * String table Series of null-terminated strings that name all the symbols in the directory. Each string begins immediately after the null character in the previous string. The number of strings must be equal to the value of the Number of Symbols fields.

The elements in the Off
sets array must be arranged in ascending order. This fact implies that the symbols listed in the String Table must be arranged according to the order of archive members. For example, all the symbols in the first object-file member would have to be listed before the symbols in the second object file.

The second linker member
The second linker member has the name "/" as does the first linker member.
Lcclnk does not use it. The second linker member includes symbol names in lexical order, which enables faster searching by name.

Offset Size Field Descri
ption
0 4 Number of members Unsigned long containing the number of archive members.
4 4*m Offsets Array of file offsets to archive member headers, arranged in ascending order. Each offset is an unsigned long. The number m is equal to the value of the Number of Members field.
* 4 Number of symbols Unsigned long containing the number of symbols indexed. Each object-file member typically defines one or more external symbols.
* 2*n Indices Array of 1-based indices (unsigned short) which map symbol names to archive member offsets. The number n is equal to Number of Symbols. For each symbol named in the String Table, the corresponding element in the Indices array gives an index into the Offsets array. The Offsets array, in turn, gives the location of the archive member that contains the symbol.
* * String table Series of null terminated strings that contain the symbol names, sorted alphabetically.

Once all those headers
are written, the only thing to do is to write the object files, each preceded by a header.

Usage of lcclib
An option consists of an option specifier, which is either a dash ( - ) or a forward slash ( / ), followed by the name of the option. Option names cannot be abbreviated.

Some options take an argument, specified after a colon (:). No spaces or tabs are allowed within an option specification. Use one or more spaces or tabs to separate option specifications on the command line.

Option names and their keyword or filename arguments are not case sensitive, but identifiers used as arguments are case sensitive.

lcclib processes options in the order specified on the command line and in command files. If an option is repeated with different arguments, the last one to be processed takes precedence.

/VERBOSE
Displays details about the progress of the session. The information is sent to standard output and can be redirected to a file.
/LIST
Displays information about the output library to standard output. The output can be redirected to a file. You can use /LIST to determine the contents of an existing library without modifying it.
/OUT:filename
Overrides the default output filename. By default, the output library is created in the current directory, with the base name of the first library or object file on the command line and the extension .LIB.
/REMOVE:object
Omits the specified object from the output library. LCCLIB creates an output library by first combining all objects (whether in object files or libraries), and then deleting any objects specified with /REMOVE.

Lcclib source files
The whole code of lcclib is a single file called appropriately lib.c. It is very small, but it implements all the machinery described above.

The resource editor
I wrote a resource editor for JFC Informatique & Média in 1994, for Windows 3.1. That editor was specially tailored to them and started with the need that they have, of producing high quality dialog boxes and resources for their applications.

They used the ‘MDI’ paradigm in all their applications. Problem is, it wasn’t easy to create the controls in the MDI’s by hand. They attempted this at the beginning, but quickly they arrived to the conclusion that they needed a tool for writing their dialog boxes and designing them interactively. They paid me an amount of money to do it, and I delivered to them an editor that could design dialog boxes without using dialog units, as they desired. The problem of dialog box units, as you maybe have experienced, is that it is impossible when you use them, to specify the positions in pixels. This means that depending on the circumstances your controls will miss a pixel here and there, and will not be exactly aligned. This was unacceptable for them.

I decided to use the experience I had accumulated about resources and resource files, to build a resource editor for Lcc-Win32.

The best place for starters was evidently the code of DLGEDIT, a simple dialog box editor that is distributed freely by Microsoft with the SDK. That code is clear, more or less easy to follow if you understand what the program is doing. So, I think that the best would be that we start by that: what the program is doing, i.e. the format of the .RES files under WIN32.

The format of the .RES files

The only document that briefly describes the format of the resource files is the one by Steve Firebaugh that appears in the MSDN CDs under the strange title of ‘Windows NT File format specification’, sub item ‘Win32 Binary Resource formats’

There are currently about a dozen predefined resource types. These include Menus, Dialogs, Accelerators, Strings, Icons, Cursors, Bitmaps, Fonts, and Version. These resources are used by the Windows system to define the appearance of the application window, or to store dialog templates or other data.. The resource script (RC file) allows the application writer to represent these features in an easily editable form.
The general format of the entire resource file is simply a number of resource file entries concatenated together. Each resource contains the information about a single resource, such as a dialog template or a string table.
Each entry consists of a resource header followed by the data for that resource. A resource header is composed of four elements: two DWORDs containing the size of the header and the size of the resource data, the resource type, the resource name, and additional resource information. The data for the resource follows the resource header and is specific to each particular type of resource.

The reasons for this are simple: To go from one resource to the next within the file, you just add the fields for the header and the data, and you are all set... if you forget the alignment problems of course.

After the “Header size” field, we find immediately after it a data structure we will meet very often here: a ‘Name or ordinal’. Simply put, you examine the first WORD. If it is -1 (0xFFFFFF) the next WORD indicates the ordinal that is used instead of a name. If the first word is NOT -1, this means that a wide character set string starts at the given position, finished with a double zero byte.

The fixed part header then, is followed by a ‘Name or ordinal’ indicating the type of the resource that follows. The predefined resource types are described in the Appendix .If the type field is a string, its a user defined type. Lcc, for the time being doesn’t use those.

This is followed by the name of the resource that is in most cases just an ID to save space.
The predefines resource IDs that weditres understands are the following:

Resource type Numerical i
dentifier
Cursor 1
Bitmap 2
Icon 3
Menu 4
Dialog 5
String table 6
Font directory 7
Font 8
Accelerators 9
RCDATA 10
Message table 11
Group cursor 12
Group Icon 14
Version resource 16
Include file name 17

The other fields of the
header are language ID for indicating the language used, some flags to specify how the resource will be loaded, that are maintained mostly for compatibility with older Windows 3.1 applications, some version information and a ‘Characteristics’ field.

So, we have for our header the following format:
struct tagResource {
DWORD DataSize; //Size of data without header
DWORD HeaderSize; //Length of the additional header
Ordinal or name TYPE //Type identifier, id or string
Ordinal or name NAME //Name identifier, id or string
DWORD DataVersion; // Predefined resource data version
WORD MemoryFlags; //State of the resource
WORD LanguageId; //Encoded language ID
DWORD Version; //Version of the resource data
DWORD Characteristics;//Characteristics of the data
} ;

Since this is not a regular C structure, we have to find out which type of data (ordinal or name type) each time we access it. In the code of the resource editor we do this in functions called “SkipResHeader”, etc, that will parse the fields according to the type of data stored in them. All those functions, together with the code to read and decode, write and encode resources are in the file “util.c”, in the resource editor source distribution.
Building a dialog box dynamically
Having read the resource file into memory, we have all the information needed to build a resource like a dialog box dynamically. The procedure for doing this is essentially very simple: Read the header, that contains the number of controls of the dialog box, and loop for each child window, making a CreateWindowEx() for each control. You get the position of each window to be created from the resource object, together with the class, font to be used, etc.

Of course this is more easily said than done...

I use the same structure that Microsoft proposed for doing that in the windows SDK. I use a ‘grabber’ window, that is created in front of each control, and that lives only to be able to drag and drop the controls, in this way allowing the user to manipulate them visually.

The core of this process is building the data structure in memory that will be accepted by the DialogBoxIndirect function. This structure consists of two parts: a header for the dialog box, and a list of controls that follows it in memory. Beginning with the resource of the dialog box, I write that structure in the function ResToDialog, in dlgio.c, one of the central parts of weditres.
First then, I get the dialog box header, in the following structure:

typedef struct {
DWORD lStyle; // Style for the dialog.
DWORD lExtendedStyle; // The extended style.
WORD NumberOfItems; // Number of controls.
WORD x; // Starting x location.
WORD y; // Starting y location.
WORD cx; // Dialog width.
WORD cy; // Dialog height.
} DIALOGBOXHEADER,*PDIALOGBOXHEADER;

As you can see from the above definition, the number of items that follow is given. We have then, after this, NumberOfItems times the following structure used for each control:

typedef struct tagControlItem {
DWORD Style; // Style for the control.
DWORD lExtendedStyle; // The extended style.
WORD x; // Starting x location.
WORD y; // Starting y location.
WORD cx; // Control width.
WORD cy; // Control height.
WORD ID; // Control id.
char Class;
} CONTROLITEM;

Reading the binary res file, I build this structure in memory, and there it goes, I pass it to DialogBoxIndirect.

I encountered a difficult problem with the dialog boxes that used the extended styles. Microsoft changed the specifications for the dialog box header and the control items. It took me hours under the debugger to try to figure out what needed to be done and what changed. Several months later, I found a small notice in the SDK, that described this structure:

typedef struct tagDLGTEMPLATEEX{
WORD wDlgVer; // use 1
WORD wSignature; // use 0xFFFF
DWORD dwHelpID; // Dialog's context help ID
DWORD dwExStyle; // Extended style
DWORD dwStyle; // Style
WORD cDlgItems; // Number of controls in dialog
short x; // Initial position, horizontal
short y; // Initial position, vertical
short cx; // Width
short cy; // Height
} DLGTEMPLATEEX;

The items had changed too. Here is the definition of the new structure:

typedef struct tagDLGITEMTEMPLATEEX{
DWORD dwHelpID; // Context help ID for control
DWORD dwExStyle; // Control extended styles
DWORD dwStyle; // Style
short x; // Initial position, horizontal
short y; // Initial position, vertical
short cx; // Width
short cy; // Height
DWORD dwID; // Window ID
} DLGITEMTEMPLATEEX;

The heart of the loading of the structures from disk (in the .res file) into memory is the AllocDialogResource procedure, in dlgio.c. This function has grown into a very big and complicated piece of code, reflecting all the complexities that are inherent into reading this format.

It starts by setting a Boolean flag to indicate if we are building a control with an extended style (the “new” controls in ComCtrl32.dll, tree view, etc) or a traditional control like edit fields or check boxes. Then, it determines if we are building a new dialog from scratch or just using the selection, in the case of a copy operation for instance.

hen building a dialog for testing, i.e. when not saving/reading to disk, we have to take care to avoid including the real class of the dialog or control, since those aren’t available in the editor environment.

We calculate then, the size of the header, composed from the caption text, the class name (an ordinal) the point size of the dialog font, and all the fields detailed above. The function allocates a buffer (that is later resized as the controls are added), and writes the fixed part of the dialog box resource.

Then, we loop for each control in the dialog box, allocating and filling a control decription. The buffer is resized at each pass through the loop. We have to take care of the alignment specifications, and account for the fact that all the editor works in ANSI and not UNICODE, but the resources are all in UNICODE, i.e. two bytes for each character. It would have been maybe easier if the editor would have been always in UNICODE, but windows 95/98 users would be in bad shape since UNICODE is not supported in those systems.

The result is a RES structure, containing the size of the data, the size of the header, and followed immediately by the data itself.
Testing a dialog box interactively
To do this, the editor constructs on the fly a dialog box specification and calls DlgBoxIndirect. The procedure of that dialog handles the initialization of the diverse controls that need something to look better, like list boxes for instance, that will be filled with some lines. Some of the new controls like the tree view control, need to be initialized with some items too.

This is done in the function CreateTestDialog, in styles.c. The detailed process of creating a dialog runs like this:
We start by erasing any c
urrent selection.
We copy the current state of the dialog being edited into the list of dialog resources that the editor maintains.
We allocate memory to hold a temporary copy of the dialog and copy the current dialog resource into it.
We call the Windows API CreateDialogIndirect, passing to it the resource copy.
If creation of the dialog succeeded, we gray several menu items in the main menu, and the new dialog gains focus.
The dialog receives the WM_INITDLG message. The procedure for handling the messages sent to the dialog is called TestDlgProc, (also in styles.c). Here we loop through the controls of the dialog, looking at its type. We do some initialization actions for several classes of controls, by calling the TestInitDlg function. List boxes are filled a bit with some lines, edit fields are assigned an “Edit” character string, TreeViews are filled with some levels, etc. The idea is to simulate as far as it goes a working dialog box. The “progress” controls, need a timer, that regularly sends them “update” messages, so that they show a continuous progress, and when arrived at the end, they are again restarted, what provides a continuous display. Owner draw controls are provided a default procedure so that they show as rectangles. Drag lists are watched too, so that they receive the messages they need.
When the user presses any button that has either the ID_OK or the ID_CANCEL identifier, the dialog box is destroyed. Note that in dialog boxes where those buttons are absent the only way to close them is to press the “test” switch in the toolbar to stop the testing.
Writing the .dlg file
Thi
s file contains the description of all the dialog boxes that you define with the editor in the ‘resources’ language. It is built by parsing the binary structures used by the editor, and emitting the corresponding keywords. This is a tricky business, especially when you consider the difficulty of interpreting correctly the different bits of the class styles. There is no simple correspondence very often between a bit and a style, but the signification of a bit changes if another is on, etc. This has been a constant problem, specially now in Win32 when you have more controls to worry about!

The code for this part is in dlgio.c The principal entry point is the function Save, called directly from the main window when the menu item is selected. It receives several flags, to indicate which type of save (normal or save as) is necessary. It will prompt for a name if save as is requested, and then call WriteTheFile, giving it the type of file to write (res, rc, or dlg).

WriteTheFile is straightforward, limiting its work to resolve the extension (dlg or res) and calling a specific function WriteRes, WriteRc, or WriteDlg.
Writing the .res file
This consists simply in writing all the binary structures to disk. A special marker is emitted as the first resource to mark it as a Win32 resource file. There is a perfect correspondence between the structures stored in RAM and the format of the file in the disk, so just a call to lwrite with the data field of each dialog resource list item is necessary. Note that the writing of the resource include header file is done here too. This is a special kind of resource that indicates the path of the include file that is used to associate the numeric codes for each control (or dialog) with their symbolic counterparts.

Writing the .rc file.
This was a new development. The problem was that weditres edited only dialogs, not accelerators, menus, icons, etc. That is why in the first time I generated a .dlg file, that was included in the main .rc file, where the ASCII descriptions for all other resource types could be written.

When I found time for it, and people pressed me to do it, I added the string table editor, and the accelerator table editor to the software.

Basically those table editors are not very difficult to do/use. They edit the string table, whose format was described in the chapter about the resource compiler, and the accelerator table.

The only interesting problem was how to enter the accelerator key... It's not easy to open a window just for keyboard input that will register correctly ANY key combination. One of the biggest problems is how to detect the ALT key, a problem that I haven't solved completely. The proper way to do it is probably to follow the WM_SYSCOMMAND message, but this detects the combination of Alt+F6 Alt+F4 and Alt+any ASCII key. The other Alt+FXX combinations aren't detected, and they do not seem to generate any messages.

Another problem is the writing of all the resources in ASCII form. This was solved already for the dialog boxes, but had to be done for the accelerator tables, for the string table, and for all the icons/cursors/whatever.
The big difficulty is to keep the association between the external files needed/used by the image resources, and the binary resource data. I modified the resource compiler to emit that information if given the (undocumented) /a option. That option makes the resource compiler write to the given file name a list of all external files used by the resource. The syntax is:
lrc /afilename.dat
At the end of compilation, "filename.dat" will contain a table of external files and the resource identifiers associated with them.

To complexify even more this already cluttered problem area, we have resource directories for the image resources, that add yet another set of problems. To make possible to write icons for different screen resolutions, an icon resource can be associated with several images, that windows at run time chooses according to the resolution of the user's screen.

I had to figure out then, which resource to edit, within an icon file. I built correspondence tables, and solved (halfway) the issue.

What happens however, when weditres has loaded a binary resource file? The information about the external file is not available at all. I had two choices:
Modify the resource compi
ler so that it would understand a hexadecimal format, where I could enclose in the .rc file a binary description of the resource. Borland adopted this solution in their windows 3.11 resource compiler.
Edit/write the icons/cursor/bitmaps into temporary files, and generate a normal ICON resource statement for the resource compiler.

There are advantages/pro
blems to each of the two solutions. If I would use 1), I would loose the compatibility with Microsoft's resource compiler.


TCC

Vu dans ... http://mclaveau.com/grimoire/tcc.htm

TCC - Tiny C Compiler est un compilateur C extrêmement petit (moins de 1 Mo), mais très rapide en compilation (plus d'un million de lignes par seconde).
TCC est simpliste, mais a le gros avantage de permettre une programmation directe. Pas d'installation, il suffit de copier un dossier. Pour écrire un programme, un éditeur de texte suffit, et la mise en route est immédiate, pour une programmation quasi-instantanée. Pas de projet à définir, pas de dépendances, pas de foisonnement d'outils variés et différents, pas d'atomisation du code-source.

Historique. Au départ, Fabrice Bellard a créé OTCC pour concourir à l'IOCCC (http://fr.wikipedia.org/wiki/International_Obfuscated_C_Code_Contest), qu'il a gagné en 2002.
Il a ensuite "dé-obsfucated" OTCC, ce qui a donné TCC.

Quelques liens :

  • http://fr.wikipedia.org/wiki/Tiny_C_Compiler

  • http://bellard.org/tcc

  • http://lists.gnu.org/archive/html/tinycc-devel

  • http://repo.or.cz/w/tinycc.git (pour les utilisateurs de Git)

Mon intérêt à TCC est très limité, car je ne connais pas le langage C. J'en sais juste assez pour comprendre ce que j'ai fait. Mais, cela a un avantage : ce ne sont que des trucs simples.

Le but de cette page sur TCC est de retransmettre les quelques trouvailles que j'ai faites avec TCC sous Windows, afin d'éviter à d'autres de perdre du temps en investigations pas troujours très faciles. Des façons de faire, pour créer des DLL ou utiliser des ressources Windows, ne sont pas toujours simples à trouver.

Les exemples sont bruts, presque sans commentaires, mais assez simples à comprendre pour être utilisables par tout programmeur qui connait un minimum Windows.

1er programme - comment compiler

Voici le code-source (fichier p1.c) :

#include <stdio.h>

void main() {
    printf("Bonjour, Monde !\n");
}

Pour le compiler, utiliser cette commande :

tcc -o p1.exe p1.c

Vous obtiendrez le fichier p1.exe, parfaitement exécutable.
Voilà, vous avez créé votre premier programme avec TCC.

Ligne de commande - retrouver les arguments

Voici le code-source (fichier p2.c) :

#include <stdio.h>

void main(int argc,
                char*argv[]) {
int i;
printf("Nb: %d\n",argc);
for(i=0 ; i<argc ; i++){
printf("Arg.num.%d
                : %s \n", i, argv[i]);
}
}

Le compiler avec cette commande :

tcc -o p2.exe p2.c

Lancer ensuite p2.exe aaa 123 "ABC ZZZ" ; vous devriez voir les paramètres récupérés par le programme.

Windows

Notre première fenêtre sous Windows (fichier p3.c) :

#include <windows.h>

const char g_szClassName[] = "maclasswin";

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
   switch(msg)
   {
       case WM_CLOSE:
           MessageBox(NULL,"Demande de fermeture de la fenêtre.","Message Windows",MB_ICONEXCLAMATION | MB_OK);
           DestroyWindow(hwnd);
           break;

       case WM_DESTROY:
           PostQuitMessage(0);
           break;

       default:
           return DefWindowProc(hwnd, msg, wParam, lParam);
           break;  //à cause de certains antivirus...
   }
   return 0;
}

int WINAPI WinMain(HINSTANCE
                hInstance, HINSTANCE hPrevInstance, LPSTR
                lpCmdLine, int nCmdShow) {
WNDCLASSEX wc;
HWND hwnd;
MSG Msg;

   wc.cbSize =
                sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL,
                IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL,
                IDC_ARROW);
wc.hbrBackground =
                (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = g_szClassName;
wc.hIconSm = LoadIcon(NULL,
                IDI_APPLICATION);
if(!RegisterClassEx(&wc)) {
MessageBox(NULL,
                "Pb d'enregistrement de la fenêtre",
                "Erreur", MB_ICONEXCLAMATION | MB_OK);
return 0;
}

   hwnd = CreateWindowEx(WS_EX_CLIENTEDGE,
       g_szClassName,
       "Ma première fenêtre",   //titre
       WS_OVERLAPPEDWINDOW,
       CW_USEDEFAULT, CW_USEDEFAULT,
       320,  //largeur
       200,  //hauteur
       NULL, NULL, hInstance, NULL);

   if(hwnd == NULL)
                {
MessageBox(NULL, "Pb de création de la
                fenêtre", "Erreur",
                MB_ICONEXCLAMATION | MB_OK);
return 0;
}

   ShowWindow(hwnd, nCmdShow);
   UpdateWindow(hwnd);

   while(GetMessage(&Msg, NULL, 0, 0) > 0) {
       TranslateMessage(&Msg);
       DispatchMessage(&Msg);
   }

   return Msg.wParam;
}

Compiler avec cette commande :

tcc -o p3.exe p3.c

Alors, non seulement ce programme crée une fenêtre, mais il intercepte aussi la fermeture de la fenêtre (un message est affiché).

Ressources

Je n'ai jamais apprécié l'histoire des ressources, avec des fichiers séparés. Cela se traduit par une atomisation des code-sources, et une multiplicité des traitements péri-compilation (compilation de ressources, éditeur de liens, intégration des ressources à l'exécutable, etc.).
De plus TCC s'intègre très mal avec les éditeurs et compilateurs de ressources classiques, comme ceux de Microsoft ou de Borland.

Heureusement, il existe une possibilité, que nous allons mettre en oeuvre dans un exemple. Il s'agit d'utiliser le compilateur de ressources de MinGW. Pour cela, il faut récupérer, dans une installation MinGW, les programmes (fichiers) suivants :

    • cc1.exe

    • gcc.exe

    • windres.exe

Nous allons définir (utiliser) les ressources suivantes :

  • Un icone, fichier "ponx.ico", qui DOIT être présent dans le dossier en cours.

  • Un menu, organisé comme ça :
    Fichier
    Terminer
    Divers
    Aller
    Aller ailleurs (ligne grisée)
    3ème ligne

L'ensemble des codes-source est composé de trois fichiers :  p4.h  p4.rc  p4.c :

(fichier p4.h) Il contient les constantes identifiant les éléments des ressources :

#define ID_MONICON 201
#define ID_MONMENU 101
#define ID_TERMINER 9001
#define ID_ALLER 9002
#define ID_3 9003

(fichier p4.rc) Il contient la définition des ressources :

#include "p4.h"

ID_MONMENU MENU
BEGIN
    POPUP "&Fichier"
    BEGIN
        MENUITEM "&Terminer", ID_TERMINER
    END

    POPUP "&Divers"
    BEGIN
        MENUITEM "&Aller", ID_ALLER
        MENUITEM "A&ller ailleurs", 0, GRAYED
        MENUITEM "3ème ligne", ID_3
    END
END

ID_MONICON ICON "ponx.ico"

Le fichier source en langage C (fichier p4.c) :

#include <windows.h>
#include "p4.h"

const char g_szClassName[] = "maClasseWin";

HBITMAP g_hbmBall = NULL;

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
    switch(msg) {
        case WM_COMMAND:
            switch(LOWORD(wParam)) {
                case ID_TERMINER:
                MessageBox(hwnd, "la ligne de menu  'Terminer'", "Vous avez sélectionné", MB_OK | MB_ICONINFORMATION);
                DestroyWindow(hwnd);
                break;

                case ID_ALLER:
                MessageBox(hwnd, "la ligne de menu  'Aller'", "Vous avez sélectionné", MB_OK | MB_ICONINFORMATION);
                break;

                case ID_3:
                MessageBox(hwnd, "la ligne de menu  '3ème ligne'", "Vous avez sélectionné", MB_OK | MB_ICONINFORMATION);
                break;
            }
        break;

        case WM_LBUTTONDOWN: {
            char szFileName[MAX_PATH];
            HINSTANCE hInstance = GetModuleHandle(NULL);

                GetModuleFileName(hInstance, szFileName,
                MAX_PATH);
MessageBox(hwnd, szFileName, "Clic gauche
                dans :", MB_OK | MB_ICONINFORMATION);
}
break;

        case WM_RBUTTONDOWN: {
            char szFileName[MAX_PATH];
            HINSTANCE hInstance = GetModuleHandle(NULL);

                GetModuleFileName(hInstance, szFileName,
                MAX_PATH);
MessageBox(hwnd, szFileName, "Clic droit
                dans :", MB_OK | MB_ICONINFORMATION);
}
break;

        case WM_CLOSE:
            DestroyWindow(hwnd);
        break;

        case WM_DESTROY:
         DeleteObject(g_hbmBall);
            PostQuitMessage(0);
        break;

        default:
            return DefWindowProc(hwnd, msg, wParam, lParam);
        break;
    }
    return 0;
}

int WINAPI WinMain(HINSTANCE
                hInstance, HINSTANCE hPrevInstance, LPSTR
                lpCmdLine, int nCmdShow) {
WNDCLASSEX wc;
HWND hwnd;
MSG Msg;

    wc.cbSize        = sizeof(WNDCLASSEX);
    wc.style         = 0;
    wc.lpfnWndProc   = WndProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = hInstance;
    wc.hIcon         = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(ID_MONICON));
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
    wc.lpszMenuName  = MAKEINTRESOURCE(ID_MONMENU);
    wc.lpszClassName = g_szClassName;
    wc.hIconSm       = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(ID_MONICON), IMAGE_ICON, 16, 16, 0);
    if(!RegisterClassEx(&wc)) {
        MessageBox(NULL, "Pb d'enregistrement de la fenêtre", "Erreur", MB_ICONEXCLAMATION | MB_OK);
        return 0;
    }

    hwnd = CreateWindowEx(
        WS_EX_CLIENTEDGE,
        g_szClassName,
        "Fenêtre avec un icône et un menu (voir aussi les clics droit et gauche)",
        WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT, CW_USEDEFAULT,
        600,   //largeur
        280,   //hauteur
        NULL, NULL, hInstance, NULL
        );
    if(hwnd == NULL) {
        MessageBox(NULL, "Pb de création de la fenêtre", "Erreur", MB_ICONEXCLAMATION | MB_OK);
        return 0;
    }

    ShowWindow(hwnd, nCmdShow);
    UpdateWindow(hwnd);

    while(GetMessage(&Msg, NULL, 0, 0) > 0) {
        TranslateMessage(&Msg);
        DispatchMessage(&Msg);
    }
    return Msg.wParam;
}

Avant de compiler, il faut traiter les ressources. Pour cela, nous allons utiliser la commande :

windres.exe -O coff p4.rc -o p4.o

La compilation elle-même :

tcc p4.c p4.o -o p4.exe

Le programme p4.exe ouvre une fenêtre, avec l'icone associé (qui est maintenant intégré dans le fichier exécutable), et avec le menu prévu.
Lorsqu'un utilisateur va sélectionner (cliquer) sur une entrée du menu, l'action sera interceptée, et un message affiché.
En supplément gratuit, le programme va aussi intercepter les clics gauches et droits sur la fenêtre. Ceci ne concerne pas les ressources, mais rend l'exemple plus attractif ;-)

Image & GDI

Cet exemple ouvre une fenêtre, charge une image, à partir d'un fichier au format .BMP, et affiche trois textes, de tailles, couleurs et emplacements différents.

Voici le code-source (fichier p5.c) :

#include <windows.h>

const char g_szClassName[] =
                "maClasseWin";
HBITMAP g_hBMP = NULL;
char *pWindowText;

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
    switch(msg) {

        case WM_CREATE:
            g_hBMP = (HBITMAP)LoadImage(NULL,
                                       "tintin.bmp",     // nom du fichier
                                       IMAGE_BITMAP,     // type = bitmap
                                       0, 0,             // 0,0 = taille d'origine
                                       LR_LOADFROMFILE);

            if(g_hBMP == NULL)
                MessageBox(hwnd, "Pb pour lire tintin.bmp", "Erreur", MB_OK | MB_ICONEXCLAMATION);
            break;

        case WM_PAINT: {
            PAINTSTRUCT pst;
            RECT        rct;
            HDC hdc = BeginPaint(hwnd, &pst);

                BITMAP bm;
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hOld = SelectObject(hdcMem, g_hBMP);
GetObject(g_hBMP, sizeof(bm), &bm);
BitBlt(hdc, 100, 100, bm.bmWidth, bm.bmHeight,
                hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem, hOld);
DeleteDC(hdcMem);

                //le 36, c'est la taille de la police
HFONT hFont = CreateFont (36, 0, 0, 0, 0, 0, 0,
                0, 0, 0, 0, 0, 0, TEXT ("Arial"));
hFont = (HFONT) SelectObject (hdc, hFont);
GetClientRect(hwnd, &rct);
SetTextColor(hdc, RGB(0,0,0));
SetBkColor(hdc, RGB(255,255,255));  //
                TRANSPARENT);  //OPAQUE
//TextOut  écrit en X,Y
char *texte = "Attention !";
TextOut(hdc, 315, 145, texte, strlen(texte));
char *texte = "TCC est";
TextOut(hdc, 330, 190, texte, strlen(texte));
char *texte = "super !";
TextOut(hdc, 345, 230, texte, strlen(texte));

                char *texte = "AAAA éè €€ Hello,
                Monde !";
//le 24, c'est la taille de la police
hFont = CreateFont (24, 0, 0, 0, 0, 0, 0, 0, 0,
                0, 0, 0, 0, TEXT ("Arial"));
hFont = (HFONT) SelectObject (hdc, hFont);
SetTextColor(hdc, RGB(0,20,120));
SetBkColor(hdc, RGB(200,244,244));
//DrawText écrit à patir du début de la
                fenêtre
DrawText(hdc, texte, -1, &rct, 0);
                //DT_WORDBREAK
                DT_CENTER|DT_SINGLELINE|DT_VCENTER);

                HFONT hFont = CreateFont (24, 0, 0, 0, 0, 0, 0,
                0, 0, 0, 0, 0, 0, TEXT ("Arial"));
hFont = (HFONT) SelectObject (hdc, hFont);
GetClientRect(hwnd, &rct);
SetTextColor(hdc, RGB(180,0,20));
SetBkColor(hdc, RGB(255,200,255));  //
                TRANSPARENT);  //OPAQUE
char *texte = "  {Echap} pour
                quitter  ";
TextOut(hdc, 190, 50, texte, strlen(texte));

            EndPaint(hwnd, &pst);
        }
        break;

                case WM_KEYDOWN:
switch(wParam) {
case VK_ESCAPE:
MessageBox(hwnd, "On quitte",
                "Echap", MB_OK | MB_ICONINFORMATION);
DestroyWindow(hwnd);
break;
}
break;

        case WM_CLOSE:
            DestroyWindow(hwnd);
            break;

        case WM_DESTROY:
         DeleteObject(g_hBMP);
            PostQuitMessage(0);
            break;

        default:
            return DefWindowProc(hwnd, msg, wParam, lParam);
            break;
    }
    return 0;
}

int WINAPI WinMain(HINSTANCE
                hInstance, HINSTANCE hPrevInstance, LPSTR
                lpCmdLine, int nCmdShow) {
WNDCLASSEX wc;
HWND hwnd;
MSG Msg;

                wc.cbSize
                = sizeof(WNDCLASSEX);
wc.style
                = 0;
wc.lpfnWndProc   =
                WndProc;
wc.cbClsExtra    = 0;
wc.cbWndExtra    = 0;
wc.hInstance     = hInstance;
wc.hIcon
                = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor       =
                LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground =
                (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName  = NULL;
wc.lpszClassName =
                g_szClassName;
wc.hIconSm       =
                LoadIcon(NULL, IDI_APPLICATION);
if(!RegisterClassEx(&wc))
                {
MessageBox(NULL, "Pb d'enregistrement de la
                fenêtre", "Erreur",
                MB_ICONEXCLAMATION | MB_OK);
return 0;
}

    hwnd = CreateWindowEx(WS_EX_CLIENTEDGE,
       g_szClassName,
       "Fenêtre avec image (bmp) et textes.",   //titre
       WS_OVERLAPPEDWINDOW,
       CW_USEDEFAULT, CW_USEDEFAULT,
       640,  //largeur
       580,  //hauteur
       NULL, NULL, hInstance, NULL);
    if(hwnd == NULL) {
       MessageBox(NULL, "Pb de création de la fenêtre", "Erreur", MB_ICONEXCLAMATION | MB_OK);
       return 0;
    }

    ShowWindow(hwnd, nCmdShow);
    UpdateWindow(hwnd);

    while(GetMessage(&Msg, NULL, 0, 0) > 0) {
        TranslateMessage(&Msg);
        DispatchMessage(&Msg);
    }
    return Msg.wParam;
}

Pour le compiler, utiliser la commande :

tcc -o p5.exe p5.c

Attention, le fichier tintin.bmp DOIT être présent dans le dossier courant.

Win32API - Utiliser les API de Windows

Si de nombreuses fonctions des API de Windows sont définies en standard (dans Windows.h), certaines font partie de Shell32.DLL (ou d'autres DLL). Et, pour pouvoir utiliser (les fonctions de) cette DLL, il faut se servir de l'outil tiny_impdef.exe. Il permet d'extraire les définitions des fonctions publiques d'une DLL, dans un fichier .def

On l'utilise de cette façon : tiny_impdef.exe C:\Windows\System32\shell32.dll
le fichier shell32.def est alors créé (c'est un simple fichier texte). Nous l'utiliserons lors de la compilation.

L'exemple ci-dessous effectue la séquence de traitements suivante :

  • Lance le bloc-notes

  • Attend 2 secondes

  • Lance la calculatrice

  • Attend 2 secondes

  • Met le bloc-notes au premier-plan

  • Déplace la fenêtre (et change la taille)

  • Déplace la fenêtre (et change la taille)

  • Cache la fenêtre du bloc-notes

  • Ré-affiche la fenêtre du bloc-notes

  • Change le titre de la fenêtre

  • Simule quelques touches du clavier, dans le bloc-notes

  • Ouvre le menu "Fichier"

  • Envoie "Q" (Quitter)

  • Envoie "R" (ne pas enRegistrer)

  • Déplace la calculatrice

  • Déplace la calculatrice

  • Ferme la calculatrice

Voici le code-source (fichier p6.c) :

#include <windows.h>
#include <stdio.h>

void t(char tch) {
 keybd_event((CHAR)(SHORT)VkKeyScan(tch), 0, 0, 0);
}

void tcode(int cod) {
 keybd_event((CHAR)(SHORT)cod, 0, 0, 0);
}

void ts(char tch) {  //touche avec shift
 keybd_event( 0x10, 0, KEYEVENTF_EXTENDEDKEY | 0, 0);
 keybd_event((CHAR)(SHORT)VkKeyScan(tch), 0, 0, 0);
 keybd_event( 0x10, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
}

void tc(char tch) {  //touche avec ctrl
 keybd_event( 0x11, 0, KEYEVENTF_EXTENDEDKEY | 0, 0);
 keybd_event((CHAR)(SHORT)VkKeyScan(tch), 0, 0, 0);
 keybd_event( 0x11, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
}

void ta(char tch) {  //touche avec alt
 keybd_event( 0xA4, 0, KEYEVENTF_EXTENDEDKEY | 0, 0);
 keybd_event((CHAR)(SHORT)VkKeyScan(tch), 0, 0, 0);
 keybd_event( 0xA4, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
}

void tacode(int cod) {  //code-touche avec alt
 keybd_event( 0xA4, 0, KEYEVENTF_EXTENDEDKEY | 0, 0);
 keybd_event((CHAR)(SHORT)cod, 0, 0, 0);
 keybd_event( 0xA4, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
}

int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {

    // on lance NotePad
    // la méthode ci-dessous fonctionne, mais pas très bien.
    // int rh = (int) ShellExecuteA(0,"open","notepad.exe","","
 system("start \"\" C:\\Windows\\notepad.exe");
    Sleep(2000);  // on attend deux secondes

    //int rh = (int) ShellExecuteA(0,"open","calc.exe","","",SW_SHOWDEFAULT);
 system("start \"\" C:\\Windows\\system32\\calc.exe");
    Sleep(2000);  // on attend deux secondes

 HWND hc = FindWindow("Notepad",NULL);

 //ShowWindow(hc,SW_SHOWNORMAL);
 SetForegroundWindow(hc);
 Sleep(250);
 MoveWindow(hc, 120, 120, 800, 500, FALSE);
 Sleep(1000);
 MoveWindow(hc, 20, 20, 600, 300, FALSE);
 Sleep(100);

 char *texte;
texte="Titre modifié";
SetWindowText(hc, texte);  //on change
                le titre de la fenêtre

    Sleep(1000);
    SetFocus(hc);
    Sleep(250);
    ShowWindow( hc, SW_HIDE);
    ShowWindow( hc, SW_HIDE);
    Sleep(1000);
    ShowWindow( hc, SW_SHOW);
    Sleep(500);

 t('a'); t('b'); t('c');
                t('d'); t('e');
t('a'); t('b'); t('c'); t('d'); t('e');
t('a'); t('b'); t('c'); t('d'); t('e');
tc('m');  // {Ctrl}{M} équivaut à
                {Entrée} et à 0x0D

 t('a'); t('b'); t('c');
                t('d'); t('e');
t('a'); t('b'); t('c'); t('d'); t('e');
t('a'); t('b'); t('c'); t('d'); t('e');
tcode(0x0D);  // {Entrée}

 t('x'); t('y'); t('z');

 tcode(0x09); // {TAB}
 ts('e');  // Shift => E majuscule
 ts('e'); ts('e'); ts('e'); ts('e');

                Sleep(2000);
ta('F');   //
                {Alt}{F}
Sleep(800);
t('q');
Sleep(1000);
t('r');

    Sleep(500);
HWND hc =
                FindWindow("CalcFrame",NULL);
RECT r;
GetWindowRect(hc, &r);
MoveWindow(hc, 400, 200, r.right-r.left,
                r.bottom-r.top, TRUE);
Sleep(1000);
GetWindowRect(hc, &r);
MoveWindow(hc, 20, 20, r.right-r.left,
                r.bottom-r.top, TRUE);
Sleep(500);
PostMessage(hc, WM_CLOSE, 0,
                0);
Sleep(50);

 return 1;
}

Compilation avec cette commande :

tcc -o p6.exe p6.c shell32.def

Notez l'utilisation shell32.def pour rendre disponibles les fonctions de Shell32.dll
Détail, le fichier p6.exe, ne pèse que 4 ko.

Python26.dll - Python par utilisation d'une DLL

Utiliser Python depuis TCC est assez simple. Il suffit d'utiliser python26.dll. Pour cela, comme dans l'exemple précédent, on se sert de la commande :
tiny_impdef.exe C:\Windows\System32\python26.dll

Le code-source (fichier p7.c) est assez simple :

#include <stdio.h>

int main(int argc, char*argv[]) {
  Py_Initialize();

  PyRun_SimpleString("f=open('bbb.txt','w')\n
f.write('111111\\r\\n222222')\n
f.close()");

  PyRun_SimpleString("import ctypes\n
ctypes.windll.user32.MessageBoxW(0, u'par Python + ctypes', u'Message affiché ', 0)\n");

  Py_Finalize();
  return 0;
}

On compile avec la commande :

tcc -o p7.exe p7.c python26.def

À l'exécution, le fichier p7.exe, va faire deux choses (deux petits scripts en Python) :

  • créer un fichier texte, bbb.txt contenant 111111\n222222

  • Afficher un petit message, via ctypes

Notez aussi l'utilisation de scripts Python multi-lignes.

Créer une DLL - ammap.dll

La DLL que nous allons créer dans cet exemple est utile (ce n'est pas seulement un exemple). Elle offre un accès, en lecture et écriture à deux mmap.
Rappel : les mmap sont des fichiers mappés en mémoire, accessibles depuis plusieurs processus simultanément, sans aucun contrôle ou verrou. Les fonctions mmap existent en standard dans de nombreux langages (non MS), comme Python, Ruby, Perl, Haskell, etc. et sont très utiles pour faire de l' IPC (Inter-Processus-Communication, ou échange de données entre différents processus).

Voici le code-source (fichier p8.c) :

#include <windows.h>
#include <memory.h>
#include <string.h>

#define DLL_EXPORT __declspec(dllexport)

#define SHMEMSIZE 32767

static LPVOID lpvMem = NULL;      // pointeur pour mémoire partagée
static HANDLE hMapObject = NULL;  // handle pour mmap

static LPVOID lpvMem2 = NULL;
static HANDLE hMapObject2 = NULL;

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {

   BOOL fInit, fIgnore;

   switch (fdwReason) {
    // chargement de la DLL
    case DLL_PROCESS_ATTACH:
     break;
    // attachement d'un processus
    case DLL_THREAD_ATTACH:
     break;
    // détachement d'un processus
    case DLL_THREAD_DETACH:
     break;
    // déchargement de la DLL
    case DLL_PROCESS_DETACH:
     // unmap la mémoire partagée et ferme le mmap1
     fIgnore = UnmapViewOfFile(lpvMem);
     fIgnore = CloseHandle(hMapObject);

     //
                unmap la mémoire partagée et ferme le mmap2
fIgnore =
                UnmapViewOfFile(lpvMem2);
fIgnore =
                CloseHandle(hMapObject2);
break;
default:
break;
}
return TRUE;
UNREFERENCED_PARAMETER(hinstDLL);
UNREFERENCED_PARAMETER(lpvReserved);
}

// ------ 1 ----------------------------------------------------------------------

// Ouverture du mmap
DLL_EXPORT VOID __stdcall Open(char *nom) {

   BOOL fInit;

 // Create a named file mapping object
 hMapObject = CreateFileMapping(
  INVALID_HANDLE_VALUE,   // handle null
  NULL,                   // attributs de sécurité
  PAGE_READWRITE,         // accès read/write
  0,                      // taille: high 32-bits
  SHMEMSIZE,              // taille: low 32-bits
  nom      // nom de l'objet mappé
 );
 if (hMapObject == NULL)
  return;

 // est-ce que le mmap
                existe déjà ?
fInit = (GetLastError() !=
                ERROR_ALREADY_EXISTS);
// obtient le pointeur sur le mmap
lpvMem = MapViewOfFile(
hMapObject,
                // handle
FILE_MAP_WRITE, // accès read/write
0,
                // taille: high 32-bits
0,
                // taille: low 32-bits
0
                // default: map entire file
);
if(lpvMem == NULL) return; // si ERREUR
                ERREUR ERREUR ERREUR
// si le mmap n'existait pas déjà, on
                initialise la mémoire
if(fInit) {
memset(lpvMem, '\0', SHMEMSIZE);
return;
}
return;
}

// Fermeture du mmap
DLL_EXPORT VOID __stdcall Close(){
   BOOL fInit, fIgnore;
   fIgnore = UnmapViewOfFile(lpvMem);
   // ferme le mmap
   fIgnore = CloseHandle(hMapObject);
}

// Ecriture dans le mmap
DLL_EXPORT VOID __stdcall SetSharedMem(char *str)
                {
char *lpszTmp;
lpszTmp = (char *) lpvMem;
strncpy(lpszTmp,str,SHMEMSIZE);
}

// Lecture dans le mmap
DLL_EXPORT VOID __stdcall GetSharedMem(char *str,
                int size) {
char *lpszTmp;
lpszTmp = (char *) lpvMem;
strncpy(str,lpszTmp,size);
}

// ------ 2 ----------------------------------------------------------------------

DLL_EXPORT VOID __stdcall Open2(char *nom) {
    BOOL fInit;

 hMapObject2 = CreateFileMapping(
  INVALID_HANDLE_VALUE,
  NULL,
  PAGE_READWRITE,
  0,
  SHMEMSIZE,
  nom
 );
 if (hMapObject2 == NULL)
  return;

 fInit = (GetLastError() != ERROR_ALREADY_EXISTS);
 lpvMem2 = MapViewOfFile(
  hMapObject2,
  FILE_MAP_WRITE,
  0,
  0,
  0
 );
 if(lpvMem2 == NULL) return; // si ERREUR ERREUR ERREUR ERREUR
 if(fInit) {
  memset(lpvMem2, '\0', SHMEMSIZE);
  return;
 }
 return;
}

DLL_EXPORT VOID __stdcall
                Close2() {
BOOL fInit, fIgnore;
fIgnore = UnmapViewOfFile(lpvMem2);
fIgnore = CloseHandle(hMapObject2);
}

DLL_EXPORT VOID __stdcall
                SetSharedMem2(char *str) {
char *lpszTmp;
lpszTmp = (char *) lpvMem2;
strncpy(lpszTmp,str,SHMEMSIZE);
}

DLL_EXPORT VOID __stdcall
                GetSharedMem2(char *str, int size) {
char *lpszTmp;
lpszTmp = (char *) lpvMem2;
strncpy(str,lpszTmp,size);
}

Pour le compiler, et créer la DLL, on utilisera cette commande :

tcc -shared -o p8.dll p8.c

Notez que, en plus du fichier p8.dll, il y a création d'un fichier P8.def.

Téléchargements

Pour éviter aux lecteurs de chercher (longuement) sur le Net, je vous propose quelques téléchargements dans cette page :

  • TCC pour Windows, sur le site de TCC :
    http://download.savannah.nongnu.org/releases/tinycc/tcc-0.9.25-win32-bin.zip

  • Les fichiers-sources-exemples de cette page (compressés en un ZIP) : exsources.zip

  • Les outils du compilateur de ressources de MinGW (compressés en un ZIP) : rescompil.zip

  • Un exemple de dossier TCC prêt à l'emploi (décompresser dans C:\tcc) : tcc.zip

C'est tout !


D:\COM_CHM\Documentation CHM\_API\RC Resource Compiler\RTF\Resources.rtf

+$#AK Resources
A resource is binary data that a resource compiler or developer adds to an application's executable file. A resource can be either standard or defined. The data in a standard resource describes an icon, cursor, menu, dialog box, bitmap, enhanced metafile, font, accelerator table, message-table entry, string-table entry, or version. An application-defined resource, also called a custom resource, contains any data required by a specific application.
+$#A About Resources
 This overview describes the functions that enable applications to find a resource in a module; load a resource into memory; add, delete or replace a resource in an executable file; and generate a list of the resources contained in a module. For specific information about the organization of resource data within executable files, refer to the resource formats documentation.
For information about how to create standard resources, refer to the following table.
Resource Topic
Accelerator table Keyboard Accelerators_win32_Keyboard_Accelerators
Bitmap Bitmaps_win32_Bitmaps
Cursor Cursors_win32_Cursors
Dialog box Dialog Boxes_win32_Dialog_Boxes
Enhanced metafile Metafiles_win32_Metafiles
Font Fonts and Text_win32_Fonts_and_Text
Icon Icons_win32_Icons
Menu Menus (Windows NT)_win32_Menus_Windows_NT_
Message-table entry Your message-compiler documentation
String-table entry String Manipulation_win32_String_Manipulation
Version information File Installation Library_win32_File_Installation_Library

For information about how to include resource data in a Microsoft® Windows® executable file, refer to the documentation for your resource compiler.
+$#A F inding and Loading Resources
B efore using a resource, an application must load it into memory. The FindResource_win32_FindResource and FindResourceEx_win32_FindResourceEx functions find a resource in a module and return a handle to the binary resource data. FindResource locates a resource by type and name. FindResourceEx locates the resource by type, name, and language. Information about FindResource in this topic also applies to FindResourceEx.
The LoadResource_win32_LoadResource function uses the resource handle returned by FindResource to load the resource into memory. After an application loads a resource by using LoadResource, Windows automatically unloads and reloads the resource as memory conditions and application execution require. Thus, an application need not explicitly unload a resource it no longer needs.
An application can use FindResource and LoadResource to find and load any type of resource, but these functions should be used only if the application must access the binary resource data for subsequent function calls. To use a resource immediately, an application should use one of the following resource-specific functions to find and load resources in one call.
Function Action
FormatMessage_win32_FormatMessage Loads and formats a message-table entry.
LoadAccelerators_win32_LoadAccelerators Loads an accelerator table.
LoadBitmap_win32_LoadBitmap Loads a bitmap resource.
LoadCursor_win32_LoadCursor Loads a cursor resource.
LoadIcon_win32_LoadIcon Loads an icon resource.
LoadImage_win32_LoadImage Loads an icon, cursor, bitmap, or enhanced metafile resource.
LoadMenu_win32_LoadMenu Loads a menu resource.
LoadString_win32_LoadString Loads a string-table entry.

Before terminating, an application should release the memory occupied by accelerator tables, bitmaps, cursors, icons, and menus by using one of the functions in the following table.
Resource Release function
Accelerator table DestroyAcceleratorTable_win32_DestroyAcceleratorTable
Bitmap DeleteObject_win32_DeleteObject
Cursor DestroyCursor_win32_DestroyCursor
Icon DestroyIcon_win32_DestroyIcon
Menu DestroyMenu_win32_DestroyMenu

When the application terminates, Windows automatically releases the memory occupied by the other types of resources.
+$#A Adding, Deleting, and Replacing Resources
Applications must frequently add, delete, or replace resources in executable files. Two methods can be used to accomplish these tasks. The first is to edit the resource-definition file, recompile the resources, and add the recompiled resources to the application's executable file. The second method is to copy the resource data directly into the application's executable file.
For example, to localize an English-language application for use in Norway, it may be necessary to replace the English dialog box with one using Norwegian. A developer creates an appropriate dialog box by using a dialog box editor or by writing a template in the resource-definition file. The developer then recompiles the resources and adds the new resources to the application's executable file.
If an appropriate dialog box exists in binary form, however, the developer can copy the data directly to the executable file being localized by using three Windows functions. The BeginUpdateResource_win32_BeginUpdateResource function creates an update handle for the executable file whose resources are to be changed. The UpdateResource_win32_UpdateResource function uses this handle to add, delete, or replace a resource in the executable file. The EndUpdateResource_win32_EndUpdateResource function closes the handle.
After an update handle to an executable file is created by BeginUpdateResource, an application can use UpdateResource repeatedly to make changes to the resource data. Each call to UpdateResource contributes to an internal list of additions, deletions, and replacements but does not actually write the data to the executable file. Immediately before closing the update handle, EndUpdateResource writes the accumulated changes to the executable file.
Sometimes, an application must copy resources or find resource sizes. The LoadLibrary_win32_LoadLibrary function provides a module handle to an executable file whose resources are to be copied, and the LockResource_win32_LockResource function provides a pointer to the resource data in the specified module. The SizeofResource_win32_SizeofResource function returns the size, in bytes, of a specified resource.
+$#A Enumerating Resources
Three Windows functions enable an application to obtain lists of resource types, names, and languages in a specified module. The EnumResourceTypes_win32_EnumResourceTypes function provides a list of resource types found in the module, the EnumResourceNames_win32_EnumResourceNames function provides the name of each resource within a given type, and the EnumResourceLanguages_win32_EnumResourceLanguages function provides the language of each resource of a given name and type. These functions and their associated callback functions enable applications to create a list of all resources in a module. This process is described in Creating a Resource List_win32_Creating_a_Resource_List.
+$#A Using Resources
· Updating resources_win32_Updating_Resources
· Creating a resource list_win32_Creating_a_Resource_List

+$#A Updating Resources
The following example copies a dialog box resource from one executable file, HAND.EXE, to another, FOOT.EXE, by following these steps:
1. The LoadLibrary_win32_LoadLibrary function loads the executable file HAND.EXE.
2. The FindResource_win32_FindResource and LoadResource_win32_LoadResource functions locate and load the dialog box resource named If from the file.
3. The LockResource_win32_LockResource function returns a pointer to the dialog box resource data.
4. The BeginUpdateResource_win32_BeginUpdateResource function opens an update handle FOOT.EXE.
5. The UpdateResource_win32_UpdateResource function copies the dialog box resource from HAND.EXE to FOOT.EXE.
6. The EndUpdateResource_win32_EndUpdateResource function completes the update.

The following code implements these steps.
HRSRC hResLoad; // handle to loaded resource
HANDLE hExe; // handle to existing .EXE file
HRSRC hRes; // handle/ptr. to res. info. in hExe
HANDLE hUpdateRes; // update resource handle
char *lpResLock; // pointer to resource data
BOOL result;

// Load the .EXE file that contains the dialog box you want to copy.
hExe = LoadLibrary("hand.exe");

if (hExe == NULL) {
ErrorHandler("Could not load exe.");
}

// Locate the dialog box resource in the .EXE file.
hRes = FindResource(hExe, "AboutBox", RT_DIALOG);

if (hRes == NULL) {
ErrorHandler("Could not locate dialog box.");
}

// Load the dialog box into global memory.
hResLoad = LoadResource(hExe, hRes);

if (hResLoad == NULL) {
ErrorHandler("Could not load dialog box.");
}

// Lock the dialog box into global memory.
lpResLock = LockResource(hRes);

if (lpResLock == NULL) {
ErrorHandler("Could not lock dialog box.");
}

// Open the file to which you want to add the dialog box resource.
hUpdateRes = BeginUpdateResource("foot.exe", FALSE);

if (hUpdateRes == NULL) {
ErrorHandler("Could not open file for writing.");
}

// Add the dialog box resource to the update list.
result = UpdateResource(hUpdateRes, // update resource handle
RT_DIALOG, // change dialog box resource
"AboutBox", // dialog box name
MAKELANGID(LANG_NEUTRAL,
SUBLANG_NEUTRAL), // neutral language ID
lpResLock, // ptr to resource info
SizeofResource(hExe, hRes)); // size of resource info.

if (result == FALSE) {
ErrorHandler("Could not add resource.");
}

// Write changes to FOOT.EXE and then close it.
if (!EndUpdateResource(hUpdateRes, FALSE)) {
ErrorHandler("Could not write changes to file.");
}

// Clean up.
if (!FreeLibrary(hExe)) {
ErrorHandler("Could not free executable.");
}

+$#A Creating a Resource List
The following example creates a list of every resource in the HAND.EXE file. The list is written to the RESINFO.TXT file.
The code demonstrates how to load the executable file, create a file in which to write resource information, and call the EnumResourceTypes_win32_EnumResourceTypes function to send each resource type found in the module to the application-defined callback function EnumTypesFunc. See EnumResTypeProc_win32_EnumResTypeProc for information on callback functions of this type. This callback function uses the EnumResourceNames_win32_EnumResourceNames function to pass the name of every resource within the specified type to another application-defined callback function, EnumNamesFunc. See EnumResNameProc_win32_EnumResNameProc for information on callback functions of this type. EnumNamesFunc uses the EnumResourceLanguages_win32_EnumResourceLanguages function to pass the language of every resource of the specified type and name to a third callback function, EnumLangsFunc. See EnumResLangProc_win32_EnumResLangProc for information on callback functions of this type. EnumLangsFunc writes information about the resource of the specified type, name, and language to the RESINFO.TXT file.
char szBuffer[80]; // print buffer for EnumResourceTypes
DWORD cbWritten; // number of bytes written to res. info. file
int cbString; // length of string in sprintf

// Declare callback functions.
BOOL EnumTypesFunc(
HANDLE hModule,
LPTSTR lpType,
LONG lParam);

BOOL EnumNamesFunc(
HANDLE hModule,
LPCTSTR lpType,
LPTSTR lpName,
LONG lParam);

BOOL EnumLangsFunc(
HANDLE hModule,
LPCTSTR lpType,
LPCTSTR lpName,
WORD wLang,
LONG lParam);

// Load the .EXE whose resources you want to list.
hExe = LoadLibrary("hand.exe");

if (hExe == NULL) {
ErrorHandler("Could not load .EXE.");
}

// Create a file to contain the resource info.
hFile = CreateFile("resinfo.txt", // name of file
GENERIC_READ | GENERIC_WRITE, // access mode
0, // share mode
(LPSECURITY_ATTRIBUTES) NULL, // no security
CREATE_ALWAYS, // create flags
FILE_ATTRIBUTE_NORMAL, // file attributes
(HANDLE) NULL); // no template
if (hFile == INVALID_HANDLE_VALUE) {
ErrorHandler("Could not open file.");
}

// Find all of the loaded file's resources.
cbString = sprintf(szBuffer,
"The file contains the following resources:\n\n");

WriteFile(hFile, // file to hold resource info.
szBuffer, // what to write to the file
(DWORD) cbString, // number of bytes in szBuffer
&cbWritten, // number of bytes written
NULL); // no overlapped I/O

EnumResourceTypes(hExe, // module handle
(ENUMRESTYPEPROC)EnumTypesFunc, // callback function
0); // extra parameter

// Unload the executable file whose resources were
// enumerated and close the file created to contain
// the resource information.

FreeLibrary(hExe);
CloseHandle(hFile);

// FUNCTION: EnumTypesFunc(HANDLE, LPSTR, LONG)
//
// PURPOSE: Resource type callback

BOOL EnumTypesFunc(
HANDLE hModule, // module handle
LPTSTR lpType, // address of resource type
LONG lParam) // extra parameter, could be
// used for error checking
{
int cbString;

// Write the resource type to a resource information file.
// The type may be a string or an unsigned decimal
// integer, so test before printing.

if ((ULONG)lpType & 0xFFFF0000) {
cbString = sprintf(szBuffer, "Type: %s\n", lpType);
}
else {
cbString = sprintf(szBuffer, "Type: %u\n", (USHORT)lpType);
}

WriteFile(hFile, szBuffer, (DWORD) cbString,
&cbWritten, NULL);

// Find the names of all resources of type lpType.
EnumResourceNames(hModule,
lpType,
(ENUMRESNAMEPROC)EnumNamesFunc,
0);

return TRUE;
}

// FUNCTION: EnumNamesFunc(HANDLE, LPSTR, LPSTR, LONG)
//
// PURPOSE: Resource name callback

BOOL EnumNamesFunc(
HANDLE hModule, // module handle
LPCTSTR lpType, // address of resource type
LPTSTR lpName, // address of resource name
LONG lParam) // extra parameter, could be
// used for error checking
{
int cbString;

// Write the resource name to a resource information file.
// The name may be a string or an unsigned decimal
// integer, so test before printing.

if ((ULONG)lpName & 0xFFFF0000) {
cbString = sprintf(szBuffer, "\tName: %s\n", lpName);
}
else {
cbString = sprintf(szBuffer, "\tName: %u\n",
(USHORT)lpName);
}

WriteFile(hFile, szBuffer, (DWORD) cbString,
&cbWritten, NULL);

// Find the languages of all resources of type
// lpType and name lpName.

EnumResourceLanguages(hModule,
lpType,
lpName,
(ENUMRESLANGPROC)EnumLangsFunc,
0);

return TRUE;
}

// FUNCTION: EnumLangsFunc(HANDLE, LPSTR, LPSTR, WORD, LONG)
//
// PURPOSE: Resource language callback

BOOL EnumLangsFunc(
HANDLE hModule, // module handle
LPCTSTR lpType, // address of resource type
LPCTSTR lpName, // address of resource name
WORD wLang, // resource language
LONG lParam) // extra parameter, could be
used for error checking
{
HANDLE hResInfo;
char szBuffer[80];
int cbString = 0;

hResInfo = FindResourceEx(hModule, lpType, lpName, wLang);

// Write the resource language to the resource information file.
cbString = sprintf(szBuffer, "\t\tLanguage: %u\n",
(USHORT)wLang);

WriteFile(hFile, szBuffer, (DWORD) cbString,
&cbWritten, NULL);

// Write the resource handle and size to buffer.
cbString = sprintf(szBuffer,
"\t\thResInfo == %lx, Size == %lu\n\n",
hResInfo,
SizeofResource(hModule, hResInfo));

WriteFile(hFile, szBuffer, (DWORD) cbString,
&cbWritten, NULL);

return TRUE;
}

+$#A Resource Functions
Following are the functions used with resources.
BeginUpdateResource_win32_BeginUpdateResourceCopyImage_win32_CopyImageEndUpdateResource_win32_EndUpdateResourceEnumResLangProc_win32_EnumResLangProcEnumResNameProc_win32_EnumResNameProcEnumResourceLanguages_win32_EnumResourceLanguagesEnumResourceNames_win32_EnumResourceNamesEnumResourceTypes_win32_EnumResourceTypesEnumResTypeProc_win32_EnumResTypeProcFindResource_win32_FindResourceFindResourceEx_win32_FindResourceExLoadImage_win32_LoadImageLoadResource_win32_LoadResourceLockResource_win32_LockResourceSizeofResource_win32_SizeofResourceUpdateResource_win32_UpdateResource
Obsolete or Deleted Functions
FreeResource_win32_FreeResourceSetResourceHandler_win32_SetResourceHandlerUnlockResource_win32_UnlockResource


D:\COM_CHM\Documentation CHM\_API\RC Resource Compiler\RTF\The_RC.rtf

The resource compiler - Vu dans DOC LCC-win32.doc 7841_Ko (by Jmm)

The .rc language specifications.
This language was developed to specify resource files. It describes the basic resource types, i.e.; the following objects:

  • Menus
  • Dialog boxes
  • Accelerators
  • String tables
  • Icons
  • Bitmaps
  • Cursors
  • Fonts
  • Version
  • Each object is introduced in the following manner:

  • Name or ID OBJECTNAME [Options]

  • For instance, to specify a Menu object, you would write:

  • 2800 MENU Discardable

  • The language supposes that there is a preprocessor that allows for #defines, #if, #ifdef, etc. The specifications of the preprocessor are identical to the C preprocessor, so I will not discuss it further here.
  • This language is only slightly 'specified'. The specifications are actually the behavior of the Microsoft's resource compiler 'rc'. For instance, rc accepts that instead of writing a keyboard objectname, you can replace it with a number from 1 to 16, specifying a resource type in numerical form.

  • Parsing
  • Initially, I was tempted to use the public domain ‘rcl’ resource compiler developed by Gunther Ebert, in Leipzig. Gunther used the standard Unix approach of lex/yacc.

  • His compiler is constructed with a ‘lexer’ that is written in the ‘lex’ language specifications, and a parser, specified in the ‘yacc’ notation. The ‘lexer’ is built by a program called ‘lex’ that generates a lexer from the specifications it reads. The parser is generated by the ‘yacc’ program, that writes a parser using the specifications given in the ‘yacc’ language.

  • This approach is very flexible, but it had several disadvantages for the purposes of a resource compiler:
  • It is very hard to debug a ‘yacc’ specification.
  • Yacc and ‘flex’ are not readily available under Windows 32. I had to use my linux machine, to compile the lexer+parser, then use ftp to move the result to windows, and then recompile. And this for each change done to the specification.
  • It was very complicated to do apparently simple things like processing optional arguments etc.

  • So I decided to use the same approach as described by Fraser and Hanson in their book about lcc: the recursive descent approach.

  • The resulting parser was much smaller, and much easier to debug.

  • The parser
  • Parsing is done following a rather simple ‘algorithm’:
  • while (not EndOfFile) do {
  • token = readtok();
  • if (isAnObjectToken(token)) {
  • ParseObject(token);
  • }
  • }

  • Following are the object tokens, i.e. the tokens that introduce an object:
  • DIALOG MENU,ACCELERATORS STRINGTABLE VERSION BITMAP CURSOR ICON MESSAGETABLE

  • Simple isn’t it? The parser just ignores all input except those words. When it sees one of those, it will parse an object specification that should leave the last token untouched.

  • To avoid that the resource compiler sees a token in another context it #defines the following pre-processor symbol: RC_INVOKED. Most definitions in the windows header files are enclosed in a pair of ifdefs
  • #ifndef RC_INVOKED
  • typedef ...
  • #endif

  • This prevents random matches. If you use structure definitions in the header files the resource compiler will see, take care to enclose your definitions as shown. In any case, the consequences of seeing a random definition are not very bad, since it will only provoke a cascade of error messages.

  • The function ‘gettok() does a classification of the input passed to the parser by the preprocessor. It returns :
  • A character, i.e. a value between 32 and 127. This will be returned for commas, brackets, etc.
  • A constant between 1000 and 1999 for different classes of input, indicating whether the input is a number, an identifier, a floating point constant, a string, or other things. The value will be left in a global variable, so that the rest of the parser can use it.
  • A constant between 2000 and 3000 if the input is an rc keyword.

  • The top level parser function looks like this:

  • static int Parse(void)
  • {
  • int ttype;

  • ttype = gettok();
  • do {
  • switch(ttype) {
  • case EOI:
  • return(1);
  • case KEY_DIALOGEX:
  • ParseDialog(1);
  • break;
  • case KEY_DIALOG:
  • ParseDialog(0);
  • break;
  • // other cases omitted for brevity
  • }
  • ttype = gettok();
  • } while (ttype != EOI);

  • return(1);
  • }

  • Each of the functions called will parse the grammar for the description of the object, leaving the last token in the input. Here is the description of each one:

  • Dialog statement
  • nameID DIALOG [ load-mem] x, y, width, height[optional-statements]BEGIN control-statement . . .END

  • The ParseDialog() function retrieves the last integer/identifier, and uses that as the name for the dialog. Then, the ‘load-flags’ are parsed, but ignored. Those flags were very important under windows 3.1, but now they are not used. They were maintained to have a backward compatibility with the resource scripts written for windows 3.1.

  • The function goes on parsing the coordinates of the dialog box. After that, we arrive at the optional statements. Those can be:
  • FONT Followed by a point size, a font name, and if it is a DIALOGEX statement, the weight of the font and an italics flag.
  • CAPTION Followed by a character string indicating the caption text.
  • CLASS statement indicating the class of the dialog. Normally this is not used.
  • CHARACTERISTICS field, followed by a 32 bit number. Windows do not use this, and the resource editor never generates it.
  • STYLE followed by the window style of the dialog box window.
  • EXSTYLE followed by the extended style of the dialog box window. This can be used only within a DIALOGEX statement, and not a normal DIALOG statement.
  • LANGUAGE followed by two numbers specifying the language and the sub-language code.
  • VERSION followed by a version number for the dialog. Windows do not use this.

  • Onc
e this preliminaries are done, we can start parsing the contents of the dialog box, the different CONTROL statements. This statements have all the same syntax, excepting the CONTROL statement.
NAME text, id, x, y, wid th, hei ght [, style [, extended-style]]

Here is a table indicating for each of the named controls, its class, default styles and usage.

NAME
Remarks Default Styles Class
GROUPBOX This statement builds a transparent rectangle to group some items into a common group BS_GROUPBOX Button
LTEXT Left aligned static text SS_LEFT Static
CTEXT Centered static text SS_CENTER Static
RTEXT Right aligned static text SS_RIGHT Static
LISTBOX Builds a listbox. Normally the ‘text’ field is empty WS_BORDER LBS_NOTIFY Listbox
EDITTEXT Builds an edit field. Normally the ‘text’ field is empty ES_LEFT WS_BORDER WS_TABSTOP Edit
ICON This creates a static text window at the position specified. Since Icons have a fixed width and height, those fields are not necessary. If you specify them, the resource compiler will read and ignore them. SS_ICON Static
PUSHBOX This creates a button with the BS_PUSHBOX style BS_PUSHBOX WS_TABSTOP Button
PUSHBUTTON This creates a normal push button. BS_PUSHBUTTON WS_TABSTOP Button
RADIOBUTTON This creates a radio button BS_RADIOBUTTON Button
SCROLLBAR Creates a scroll bar WS_TABSTOP Button
STATE3 Create a three state check box BS_3STATE Button
COMBOBOX Creates a combo box Combobox
CHECKBOX Does a check box BS_CHECKBOX WS_TABSTOP Button
AUTORADIOBUTTON Radio button with the ‘automatic’ style. BS_AUTORADIOBUTTON Button
AUTOCHECKBOX Check box with the ‘automatic’ style BS_AUTOCHECKBOX Button
DEFPUSHBUTTON This is the default button that will be used when you press return. BS_DEFPUSHBUTTON WS_TABSTOP Button

The
general Control statement has the following form:
CONTROL text, id, cla ss, sty le, x, y, wid th, hei ght [, extended-style]
All statements numbered before can be written using the ‘control’ statement. They are just shorthand’s for this one.
The ‘extended style’ can only be used if it is an extended dialog (DIALOGEX).

MENU Statement
menuID MENU [load-mem][optional-statements]BEGIN item-definitions . . .END

This statement introduces a menu description, with each of the POPUPS described within a BEGIN/END block.
The binary format generated is as follows:
Normal re
source header with type 4 (menu).
A flags word. If the flags contain the ‘POPUP’ flag (0x10) this indicates an implicit begin/end block. If not, it is a menu item. The text of the popup follows in unicode characters.
A menu item contains a flags word, followed by the ID of the menu item (the parameter you will receive when processing WM_COMMAND messages), followed by the text of the menu item in unicode characters.
The last item of the menu contains the flag 0x80 to indicate the end of the menu description.
The diffe
rent image resources (icons, bitmaps, cursors)
nameID ICON [load-mem] filename
nameID BITMAP [load-mem] filename
nameID CURSOR [load-mem] filename

The specifications for those resources are like this:

The ICON statement in the .RC script does not create a single resource object, but creates a group of resources. This allows Windows-based programs a degree of device independence through the use of different pixel bitmaps on hardware configurations with differing capabilities. Icons, most often designed for differing numbers of pixel planes and pixel counts, are grouped and treated by Windows as a single resource. In the .RES and .EXE files, however, they are stored as a group of resources. These groups are stored in a .RES file with the components first (in this case the different icons [type 3]) and a group header following (type 14). The group header contains the information necessary to allow Windows to select the proper icon to display.

The components have the following structure:
[Resource header (type = 3)]

[DIB Header]
[Color DIBits of icon XOR mask]
[Monochrome DIBits of AND mask]

I had a lot of trouble building that resource header. I think I have gotten it right now, but beware... As a test of the correctness of ‘lrc’, I used ‘weditres’, that will display the icons, and decode that resource header.

Basically, the compiler treats all of these the same: it will read a file specification, and put that file unchanged in the resource file. No magic is performed, i.e. for instance for icons, the Xor of the image is not performed to have a black and white and a color version. The compiler doesn’t generate different icons for vga, svga, and other resolutions either... SO: please edit your icons with another tool before. Of course, the resource editor will eventually have an icon editor, but this is not done yet...
The string table resource
STRINGTABLE [load-mem] [optional-statements]BEGIN stringID string . . .END

As usual, the ‘load’ flags are parsed but ignored. The optional statements can be ‘Language’, ‘Characteristics’ or ‘Version’ keywords.
The format of each string is just a numerical ID, followed by the string enclosed in quotes. The usual expansions for C character strings are performed.
Strings are clustered together in blocks of 16 strings, keyed by the numerical ID. The algorithm is rather complicated;
ID should sor
t the strings, because the linker lcclnk will not sort them when transforming the resource in object files.
Transform all strings into unicode before storing them. They are stored preceded by a word indicating the string length. They are NOT zero terminated.
Use the lower 4 bits of the id to indicate a position within a block of 16 strings with consecutive Ids.
Use the upper 12 bits of the plus one, to give a resource ID for a string resource of type 6 (string table resource type).
This means th
at if you give a string an ID that is isolated from other Ids you will waste space in the resource file, since an almost empty block containing only one string+the resource header will be stored.

Here is the essential part of the string-resource writing function:
idx = 0; // running index through the table
buffer = allocate(20000); // buffer space
bufferlen = 20000; // its length
 do {
memset(slots,0,sizeof(slots))// clean the slot
first = StringTable[idx]->id;// first index
len = 32; // 16 * sizeof(word)
// the variable ‘strings’ is the total number of strings in the table
while (idx < strings ) { // fill a slot of 16 strings
id = StringTable[lastidx]->id; // get this string id
// test if this string belongs to this block
if ((first & (~0xF)) == (id & (~0xf))) {
slots[(id&0xF)] = StringTable[lastidx];
len += 2*(StringTable[lastidx]->len);
lastidx++
;
}
else
{// this block is full
break;
 }
}
// test if the buffer is big enough
if (len > bufferlen) {
len += 500;
buffer = MyRealloc(buffer,len);
bufferlen = len;
}
// Now copy all the strings found into the output buffer
p = buffer;
for (i=0; i<16; i++) {
if (slots[i] && slots[i]->len) {
len = slots[i]->len;
p = WriteWord(p,(WORD)(len));
mbstowcs((WORD *)p,slots[i]->Text,len);
p += 2*len;
}
else p = WriteWord(p,0);
}
WriteStringResource(buffer,
p - buffer,
1+(first >> 4),
characteristics,language,version);
idx = lastidx;

} while (idx < strings);

The string table format uses two bytes for each character, plus the overhead for storing the blocks. If you want to save space, it is much more efficient and faster to use a structure with a tag and a pointer to the string, and looking up that at run time yourself. As an indication, I had the string table in resource format in earlier versions of wedit. When I translated the format into a normal C structure with ASCII characters the program shrank by 22K.

The RCDATA resource
nameID RCDATA [[load-mem]][[optional-statements]]BEGIN raw-data . . .END
This resource is not extremely difficult to do. Just parse a normal header, its type in the resource header is 10, and then read a series of strings or integers between the ‘BEGIN’ and ‘END’ keywords. A thing to be remembered is that integers, unless they end with the ‘L’ are 16 bits...
The Message Table resource
nameID MESSAGETABLE filename

This resource type is generated by the message compiler mc. This tool hasn't been added to the capabilities of lrc, so you will have to get it from another compiler. Probably the capabilities of mc will be incorporated into lrc at a later stage in development. For the time being, it is only possible to use already compiled message tables. This is used in NT service executables for instance, or in other specialized applications. The format of the binary resource is very similar to the string table resource format.

The ACCELERATORS resource
Syntax:

acctablename ACCELERATORS[optional-statements]BEGIN event, idvalue, [type] [opt ions] . . .END

The acctablename token is either a number or a name. The optional statements that lrc recognizes here is only the LANGUAGE keyword.
event
Specifies the keystroke to be used as an accelerator. It can be any one of the following character types:
"char"
A single character enclosed in double quotation marks ("). The character can be preceded by a caret (^), meaning that the character is a control character.
character
An integer value representing a character. The type parameter must be ASCII.
virtual-key character
An integer value representing a virtual key. The virtual key for alphanumeric keys can be specified by placing the uppercase letter or number in double quotation marks (for example, "9" or "C"). The type parameter must be VIRTKEY.
idvalue
Specifies a 16-bit unsigned integer value that identifies the accelerator.
type
Required only when the event parameter is a character or a virtual-key character. The type parameter specifies either ASCII or VIRTKEY; the integer value of event is interpreted accordingly. When VIRTKEY is specified and event contains a string, event must be uppercase.
options
Specifies the options that define the accelerator. This parameter can be one or more of the following values:
NOINVERT
Specifies that no top-level menu item is highlighted when the accelerator is used. This is useful when defining accelerators for actions such as scrolling that do not correspond to a menu item. If NOINVERT is omitted, a top-level menu item will be highlighted (if possible) when the accelerator is used.
ALT
Causes the accelerator to be activated only if the ALT key is down.
SHIFT
Causes the accelerator to be activated only if the SHIFT key is down.
CONTROL
Defines the character as a control character (the accelerator is only activated if the CONTROL key is down). This has the same effect as using a caret (^) before the accelerator character in the event parameter.
The ALT, SHIFT, and CONTROL options apply only to virtual keys.
Resource format
The format of the accelerators is simple: they consist of a normal resource header, followed by a table of structures like this:
typedef struct tagAccelTableEntry {
WORD fFlags;// This contains the flag fields above
WORD wAscii;// Contains the value of the accelerator
WORD wId; // Contains the value of the identifier
WORD padding; // not used
} AccelTableEntry;

The fFlags field contains the values for the qualifiers described in the 'Syntax' header above. There is one called ACC_LAST, the appears in the last member of the table. Basically, this resource consists of a normal header size, followed by the entries, each one, containing the structure above.
I always write the last empty table member, with all its members to zero, and only in the fFlags field, the value ACC_LAST, but I am not sure if this is really necessary, since the size of the table can be easily deduced from the size of the resource divided by the size of each element.

Limitations of the resource compiler
The FONT resources are not supported yet. They will be added in the future as time permits...
The same is true for the user defined resource types.

The source distribution of the resource compiler
The sources of the resource compiler are located in \lcc\src\lrc. The following files are in there :
parse.c. Main file of t
  • he resource compiler. Everything, from lexing to resource file generation is contained in this file.
  • ncpp.c. The preprocessor for the resource compiler. It is almost the same code as the same named file in the C compiler distribution. It is there because I decided to separate the modifications done to the preprocessor code from the ones in lrc, that needs much less complexity for its own modest needs.
  • The main file contains
a lexer in a very similar pattern that lcc uses. It will return an integer with the token parsed so far. The parsing routines decide how the tokens are interpreted.


Resources.rtf

+$#AK Resources

A resource is binary data that a resource compiler or developer adds to an application's executable file. A resource can be either standard or defined. The data in a standard resource describes an icon, cursor, menu, dialog box, bitmap, enhanced metafile, font, accelerator table, message-table entry, string-table entry, or version. An application-defined resource, also called a custom resource, contains any data required by a specific application.

+$#A About Resources

This overview describes the functions that enable applications to find a resource in a module; load a resource into memory; add, delete or replace a resource in an executable file; and generate a list of the resources contained in a module. For specific information about the organization of resource data within executable files, refer to the resource formats documentation.

For information about how to create standard resources, refer to the following table.

Resource |  | Topic
Accelerator table |  | Keyboard Accelerators
Bitmap | Bitmaps
Cursor | Cursors
Dialog box | Dialog Boxes
Enhanced metafile | Metafiles
Font | Fonts and Text
Icon | Icons
Menu | Menus (Windows NT)
Message-table entry | Your message-compiler documentation
String-table entry | String Manipulation
Version information |  | File Installation Library

For information about how to include resource data in a Microsoft® Windows® executable file, refer to the documentation for your resource compiler.

+$#A Finding and Loading Resources

Before using a resource, an application must load it into memory. The FindResource and FindResourceEx functions find a resource in a module and return a handle to the binary resource data. FindResource locates a resource by type and name. FindResourceEx locates the resource by type, name, and language. Information about FindResource in this topic also applies to FindResourceEx.

The LoadResource function uses the resource handle returned by FindResource to load the resource into memory. After an application loads a resource by using LoadResource, Windows automatically unloads and reloads the resource as memory conditions and application execution require. Thus, an application need not explicitly unload a resource it no longer needs.

An application can use FindResource and LoadResource to find and load any type of resource, but these functions should be used only if the application must access the binary resource data for subsequent function calls. To use a resource immediately, an application should use one of the following resource-specific functions to find and load resources in one call.

Function |  | Action
FormatMessage |  | Loads and formats a message-table entry.
LoadAccelerators | Loads an accelerator table.
LoadBitmap | Loads a bitmap resource.
LoadCursor | Loads a cursor resource.
LoadIcon | Loads an icon resource.
LoadImage | Loads an icon, cursor, bitmap, or enhanced metafile resource.
LoadMenu | Loads a menu resource.
LoadString |  | Loads a string-table entry.

Before terminating, an application should release the memory occupied by accelerator tables, bitmaps, cursors, icons, and menus by using one of the functions in the following table.

Resource |  | Release function
Accelerator table |  | DestroyAcceleratorTable
Bitmap | DeleteObject
Cursor | DestroyCursor
Icon | DestroyIcon
Menu |  | DestroyMenu

When the application terminates, Windows automatically releases the memory occupied by the other types of resources.

+$#A Adding, Deleting, and Replacing Resources

Applications must frequently add, delete, or replace resources in executable files. Two methods can be used to accomplish these tasks. The first is to edit the resource-definition file, recompile the resources, and add the recompiled resources to the application's executable file. The second method is to copy the resource data directly into the application's executable file.

For example, to localize an English-language application for use in Norway, it may be necessary to replace the English dialog box with one using Norwegian. A developer creates an appropriate dialog box by using a dialog box editor or by writing a template in the resource-definition file. The developer then recompiles the resources and adds the new resources to the application's executable file.

If an appropriate dialog box exists in binary form, however, the developer can copy the data directly to the executable file being localized by using three Windows functions. The BeginUpdateResource function creates an update handle for the executable file whose resources are to be changed. The UpdateResource function uses this handle to add, delete, or replace a resource in the executable file. The EndUpdateResource function closes the handle.

After an update handle to an executable file is created by BeginUpdateResource, an application can use UpdateResource repeatedly to make changes to the resource data. Each call to UpdateResource contributes to an internal list of additions, deletions, and replacements but does not actually write the data to the executable file. Immediately before closing the update handle, EndUpdateResource writes the accumulated changes to the executable file.

Sometimes, an application must copy resources or find resource sizes. The LoadLibrary function provides a module handle to an executable file whose resources are to be copied, and the LockResource function provides a pointer to the resource data in the specified module. The SizeofResource function returns the size, in bytes, of a specified resource.

+$#A Enumerating Resources

Three Windows functions enable an application to obtain lists of resource types, names, and languages in a specified module. The EnumResourceTypes function provides a list of resource types found in the module, the EnumResourceNames function provides the name of each resource within a given type, and the EnumResourceLanguages function provides the language of each resource of a given name and type. These functions and their associated callback functions enable applications to create a list of all resources in a module. This process is described in Creating a Resource List.

+$#A Using Resources

• Updating resources

• Creating a resource list

+$#A Updating Resources

The following example copies a dialog box resource from one executable file, HAND.EXE, to another, FOOT.EXE, by following these steps:

1. The LoadLibrary function loads the executable file HAND.EXE.

2. The FindResource and LoadResource functions locate and load the dialog box resource named If from the file.

3. The LockResource function returns a pointer to the dialog box resource data.

4. The BeginUpdateResource function opens an update handle FOOT.EXE.

5. The UpdateResource function copies the dialog box resource from HAND.EXE to FOOT.EXE.

6. The EndUpdateResource function completes the update.

The following code implements these steps.

HRSRC hResLoad; // handle to loaded resource

HANDLE hExe; // handle to existing .EXE file

HRSRC hRes; // handle/ptr. to res. info. in hExe

HANDLE hUpdateRes; // update resource handle

char *lpResLock; // pointer to resource data

BOOL result;

// Load the .EXE file that contains the dialog box you want to copy.

hExe = LoadLibrary("hand.exe");

if (hExe == NULL) {

ErrorHandler("Could not load exe.");

}

// Locate the dialog box resource in the .EXE file.

hRes = FindResource(hExe, "AboutBox", RT_DIALOG);

if (hRes == NULL) {

ErrorHandler("Could not locate dialog box.");

}

// Load the dialog box into global memory.

hResLoad = LoadResource(hExe, hRes);

if (hResLoad == NULL) {

ErrorHandler("Could not load dialog box.");

}

// Lock the dialog box into global memory.

lpResLock = LockResource(hRes);

if (lpResLock == NULL) {

ErrorHandler("Could not lock dialog box.");

}

// Open the file to which you want to add the dialog box resource.

hUpdateRes = BeginUpdateResource("foot.exe", FALSE);

if (hUpdateRes == NULL) {

ErrorHandler("Could not open file for writing.");

}

// Add the dialog box resource to the update list.

result = UpdateResource(hUpdateRes, // update resource handle

RT_DIALOG, // change dialog box resource

"AboutBox", // dialog box name

MAKELANGID(LANG_NEUTRAL,

SUBLANG_NEUTRAL), // neutral language ID

lpResLock, // ptr to resource info

SizeofResource(hExe, hRes)); // size of resource info.

if (result == FALSE) {

ErrorHandler("Could not add resource.");

}

// Write changes to FOOT.EXE and then close it.

if (!EndUpdateResource(hUpdateRes, FALSE)) {

ErrorHandler("Could not write changes to file.");

}

// Clean up.

if (!FreeLibrary(hExe)) {

ErrorHandler("Could not free executable.");

}

+$#A Creating a Resource List

The following example creates a list of every resource in the HAND.EXE file. The list is written to the RESINFO.TXT file.

The code demonstrates how to load the executable file, create a file in which to write resource information, and call the EnumResourceTypes function to send each resource type found in the module to the application-defined callback function EnumTypesFunc. See EnumResTypeProc for information on callback functions of this type. This callback function uses the EnumResourceNames function to pass the name of every resource within the specified type to another application-defined callback function, EnumNamesFunc. See EnumResNameProc for information on callback functions of this type. EnumNamesFunc uses the EnumResourceLanguages function to pass the language of every resource of the specified type and name to a third callback function, EnumLangsFunc. See EnumResLangProc for information on callback functions of this type. EnumLangsFunc writes information about the resource of the specified type, name, and language to the RESINFO.TXT file.

char szBuffer[80]; // print buffer for EnumResourceTypes

DWORD cbWritten; // number of bytes written to res. info. file

int cbString; // length of string in sprintf

// Declare callback functions.

BOOL EnumTypesFunc(

HANDLE hModule,

LPTSTR lpType,

LONG lParam);

BOOL EnumNamesFunc(

HANDLE hModule,

LPCTSTR lpType,

LPTSTR lpName,

LONG lParam);

BOOL EnumLangsFunc(

HANDLE hModule,

LPCTSTR lpType,

LPCTSTR lpName,

WORD wLang,

LONG lParam);

// Load the .EXE whose resources you want to list.

hExe = LoadLibrary("hand.exe");

if (hExe == NULL) {

ErrorHandler("Could not load .EXE.");

}

// Create a file to contain the resource info.

hFile = CreateFile("resinfo.txt", // name of file

GENERIC_READ | GENERIC_WRITE, // access mode

0, // share mode

(LPSECURITY_ATTRIBUTES) NULL, // no security

CREATE_ALWAYS, // create flags

FILE_ATTRIBUTE_NORMAL, // file attributes

(HANDLE) NULL); // no template

if (hFile == INVALID_HANDLE_VALUE) {

ErrorHandler("Could not open file.");

}

// Find all of the loaded file's resources.

cbString = sprintf(szBuffer,

"The file contains the following resources:\n\n");

WriteFile(hFile, // file to hold resource info.

szBuffer, // what to write to the file

(DWORD) cbString, // number of bytes in szBuffer

&cbWritten, // number of bytes written

NULL); // no overlapped I/O

EnumResourceTypes(hExe, // module handle

(ENUMRESTYPEPROC)EnumTypesFunc, // callback function

0); // extra parameter

// Unload the executable file whose resources were

// enumerated and close the file created to contain

// the resource information.

FreeLibrary(hExe);

CloseHandle(hFile);

// FUNCTION: EnumTypesFunc(HANDLE, LPSTR, LONG)

//

// PURPOSE: Resource type callback

BOOL EnumTypesFunc(

HANDLE hModule, // module handle

LPTSTR lpType, // address of resource type

LONG lParam) // extra parameter, could be

// used for error checking

{

int cbString;

// Write the resource type to a resource information file.

// The type may be a string or an unsigned decimal

// integer, so test before printing.

if ((ULONG)lpType & 0xFFFF0000) {

cbString = sprintf(szBuffer, "Type: %s\n", lpType);

}

else {

cbString = sprintf(szBuffer, "Type: %u\n", (USHORT)lpType);

}

WriteFile(hFile, szBuffer, (DWORD) cbString,

&cbWritten, NULL);

// Find the names of all resources of type lpType.

EnumResourceNames(hModule,

lpType,

(ENUMRESNAMEPROC)EnumNamesFunc,

0);

return TRUE;

}

// FUNCTION: EnumNamesFunc(HANDLE, LPSTR, LPSTR, LONG)

//

// PURPOSE: Resource name callback

BOOL EnumNamesFunc(

HANDLE hModule, // module handle

LPCTSTR lpType, // address of resource type

LPTSTR lpName, // address of resource name

LONG lParam) // extra parameter, could be

// used for error checking

{

int cbString;

// Write the resource name to a resource information file.

// The name may be a string or an unsigned decimal

// integer, so test before printing.

if ((ULONG)lpName & 0xFFFF0000) {

cbString = sprintf(szBuffer, "\tName: %s\n", lpName);

}

else {

cbString = sprintf(szBuffer, "\tName: %u\n",

(USHORT)lpName);

}

WriteFile(hFile, szBuffer, (DWORD) cbString,

&cbWritten, NULL);

// Find the languages of all resources of type

// lpType and name lpName.

EnumResourceLanguages(hModule,

lpType,

lpName,

(ENUMRESLANGPROC)EnumLangsFunc,

0);

return TRUE;

}

// FUNCTION: EnumLangsFunc(HANDLE, LPSTR, LPSTR, WORD, LONG)

//

// PURPOSE: Resource language callback

BOOL EnumLangsFunc(

HANDLE hModule, // module handle

LPCTSTR lpType, // address of resource type

LPCTSTR lpName, // address of resource name

WORD wLang, // resource language

LONG lParam) // extra parameter, could be

used for error checking

{

HANDLE hResInfo;

char szBuffer[80];

int cbString = 0;

hResInfo = FindResourceEx(hModule, lpType, lpName, wLang);

// Write the resource language to the resource information file.

cbString = sprintf(szBuffer, "\t\tLanguage: %u\n",

(USHORT)wLang);

WriteFile(hFile, szBuffer, (DWORD) cbString,

&cbWritten, NULL);

// Write the resource handle and size to buffer.

cbString = sprintf(szBuffer,

"\t\thResInfo == %lx, Size == %lu\n\n",

hResInfo,

SizeofResource(hModule, hResInfo));

WriteFile(hFile, szBuffer, (DWORD) cbString,

&cbWritten, NULL);

return TRUE;

}

+$#A Resource Functions

Following are the functions used with resources.

BeginUpdateResource
CopyImage
EndUpdateResource
EnumResLangProc
EnumResNameProc
EnumResourceLanguages
EnumResourceNames
EnumResourceTypes
EnumResTypeProc
FindResource
FindResourceEx
LoadImage
LoadResource
LockResource
SizeofResource
UpdateResource

Obsolete or Deleted Functions

FreeResource
SetResourceHandler
UnlockResource

Créé avec HelpNDoc Personal Edition: Créer des livres électroniques facilement

Copyright © 2014 by J2M for Micro Programmation Informatique


D:\Com_CHM\CHM Prgm API\RC Resource Compiler\RTF\RC_133.RTF

Vu dans .... RC.hlp 133Ko

+$#K{bmc bm0.BMP}%XVELT1>index2
Resource Compiler for Windows NT
Microsoft Windows Resource Compiler (RC) is a tool for the Microsoft Windows NT operating system. This document describes how to create a resource-definition (script) file, and how to compile your application's resources and add them to the application's executable file.
Contents
Including Resources in an Application.X2HNW
Creating a Resource-Definition File427O2DB
Preprocessing DirectivesH.3QDN
Single-Line Statements1DSSWOK
Multiline Statements1VYW4OO
Sample Resource-Definition File1GRB.VF
Using RC (The RC Command Line)Q21XEK
Defining Names for the Preprocessor11C18WU
Renaming the Compiled Resource File3NWJR.8
Searching for Files10IXKA9
Displaying Progress MessagesEJO_NW
Resource-Definition StatementsS69MTP
Common Statement ParametersXZYYJY
Common Resource AttributesG1NESG
Statement Reference67UJIQ>index2
Preprocessing Reference1MISHD_
RC Diagnostic MessagesL0NW.T
+$#K{bmc bm0.BMP}%XVELT1>index2
Including Resources in an Application
To include resources in your 32-bit Windows application, do the following:
1. Create individual resource files for cursors, icons, bitmaps, dialog boxes, and fonts. To do this, you can use Microsoft Image Editor and Dialog Editor (IMAGEDIT.EXE and DLGEDIT.EXE) and Microsoft Windows Font Editor (FONTEDIT.EXE).
2. Create a resource-definition file (script) that describes all the resources used by the application.
3. Compile the script into a resource (.RES) file with RC.
4. Link the compiled resource files into the application's executable file.

Unlike for the 16-bit versions of the Windows development system, you do not use RC to include compiled resources into the executable file or to mark the file as a Windows application. The linker recognizes the compiled resource files and links them to the executable file.
+$#K{bmc bm0.BMP}%XVELT1>index2
Creating a Resource-Definition File
After creating individual resource files for your application's icon, cursor, font, bitmap, and dialog-box resources, you create a resource-definition file, or script. A script file is a text file with the extension .RC.
The script lists every resource in your application and describes some types of resources in great detail. For a resource that exists in a separate file, such as an icon or cursor, the script names the resource and the file that contains it. For some resources, such as a menu, the entire definition of the resource exists within the script .
A script file can contain the following types of information:
· Preprocessing directives, which instruct RC to perform actions on the script before compiling it. Directives can also assign values to names.
· Statements, which name and describe resources.

The following sections describe directives and statements you can use in a script. For detailed descriptions and syntax for each statement, see "Resource-Definition StatementsS69MTP".
+$#K{bmc bm0.BMP}%XVELT1>index2
Preprocessing Directives
The following directives can be used as needed in the script to instruct RC to perform actions or to assign values to names:
Directive Description
#define_define Defines a specified name by assigning it a given value.
#elif_elif Marks an optional clause of a conditional-compilation block.
#else_else Marks the last optional clause of a conditional-compilation block.
#endif_endif Marks the end of a conditional-compilation block.
#if_if Conditionally compiles the script if a specified expression is true.
#ifdef_ifdef Conditionally compiles the script if a specified name is defined.
#ifndef_ifndef Conditionally compiles the script if a specified name is not defined.
#include_include Copies the contents of a file into the resource-definition file.
#undef_undef Removes the definition of the specified name.

The syntax and semantics for the RC preprocessor is the same as for a C compiler. For more information on preprocessing in RC, see "Preprocessing Reference1MISHD_".
+$#K{bmc bm0.BMP}%XVELT1>index2
Single-Line Statements
A single-line statement can begin with any of the following keywords:
Keyword Description
BITMAPFEGV3M Defines a bitmap by naming it and specifying the name of the file that contains it. (To use a particular bitmap, the application requests it by name.)
CURSORGQF1AO Defines a cursor by naming it and specifying the name of the file that contains it. (To use a particular cursor, the application requests it by name.)
FONT_FONT Specifies the name of a file that contains a font.
ICON_ICON Defines an icon by naming it and specifying the name of the file that contains it. (To use a particular icon, the application requests it by name.)
LANGUAGEKMK1GX Sets the language for all resources up to the next LANGUAGE statement or to the end of the file. When the LANGUAGE statement appears before the BEGIN in an ACCELERATORS, DIALOG, MENU, RCDATA, or STRINGTABLE resource definition, the specified language applies only to that resource.
MESSAGETABLE1.XLR0G Defines a message table by naming it and specifying the name of the file that contains it. The file is a binary resource file generated by the Message Compiler.

+$#K{bmc bm0.BMP}%XVELT1>index2
Multiline Statements
A multiline statement can begin with any of the following keywords:
Keyword Description
ACCELERATORS7GJLS6 Defines menu accelerator keys.
DIALOGHE4UAD Defines a template that an application can use to create dialog boxes.
MENU_MENU Defines the appearance and function of a menu.
RCDATA95VJYY Defines data resources. Data resources let you include binary data in the executable file.
STRINGTABLE1UH1OD0 Defines string resources. String resources are Unicode strings that can be loaded from the executable file.

Each of these multiline statements allows optional statements before the BEGIN ... END block that defines the resource. You can specify zero or more of the following statements:
Statement Decription
CHARACTERISTICS dwor d AFGW2L User-defined information about the resource that can be used by tools that read and write resource files. The value appears in the compiled resource file. However, it is not stored in the executable file and is not used by Windows.
LANGUAGE lang u age, sub la nguageKMK1GX Specifies the language for the resource. The parameters are constants from WINNLS.H.
VERSION dwor d.5OWYK User-defined version number for the resource that can be used by tools that read and write resource files. The value appears in the compiled resource file. However, it is not stored in the executable file and is not used by Windows.

+$#K{bmc bm0.BMP}%XVELT1>index2
Sample Resource-Definition File
The following example shows a script file that defines the resources for an application named Shapes:
#include "SHAPES.H"ShapesCursor CURSOR SHAPES.CURShapesIcon ICON SHAPES.ICOShapesMenu MENU BEGIN POPUP "&Shape" BEGIN MENUITEM "&Clear", ID_CLEAR MENUITEM "&Rectangle", ID_RECT MENUITEM "&Triangle", ID_TRIANGLE MENUITEM "&Star", ID_STAR MENUITEM "&Ellipse", ID_ELLIPSE END END

The CURSORGQF1AO statement names the application's cursor resource ShapesCursor and specifies the cursor file SHAPES.CUR, which contains the image for that cursor.
The ICON_ICON statement names the application's icon resource ShapesIcon and specifies the icon file SHAPES.ICO, which contains the image for that icon.
The MENU_MENU statement defines an application menu named ShapesMenu, a pop-up menu with five menu items.
The menu definition, enclosed by the BEGIN and END keywords, specifies each menu item and the menu identifier that is returned when the user selects that item. For example, the first item on the menu, Clear, returns the menu identifier ID_CLEAR when the user selects it. The menu identifiers are defined in the application header file, SHAPES.H.
+$#K{bmc bm0.BMP}%XVELT1>index2
Using RC (The RC Command Line)
To start RC, use the RC command. The following line shows RC command-line syntax:
RC [options] script-file
The RC command's options parameter can include one or more of the following options:
/?
Displays a list of RC command-line options.
/d
Defines a symbol for the preprocessor that you can test with the #ifdef directive.
/foresname
Uses resname f or the name of the .RES file.
/h
Displays a list of RC command-line options.
/i
Searches the specified directory before searching the directories specified by the INCLUDE environment variable.
/lcodepage
Specifies default language for compilation. For example, -l409 is equivalent to including the following statement at the top of the resource script file:
LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US

/r
Ignored. Provided for compatibility with existing makefiles.
/v
Displays messages that report on the progress of the compiler.
/x
Prevents RC from checking the INCLUDE environment variable when searching for header files or resource files.

Options are not case-sensitive, and a hyphen (-) can be used in place of a slash mark (/). You can combine single-letter options if they do not require any additional parameters. For example, the following two commands are equivalent:
RC /V /X SAMPLE.RC
rc -vz sample.rc

The script-file parameter specifies the name of the resource-definition file that contains the names, types, filenames, and descriptions of the resources to be compiled.
+$#K{bmc bm0.BMP}%XVELT1>index2
Defining Names for the Preprocessor
You can specify conditional compilation in a script, based on whether a name is defined on the RC command line with the /d option, or in the file or an include file with the #define directive.
For example, suppose your application has a pop-up menu, the Debug menu, that should appear only with debugging versions of the application. When you compile the application for normal use, the Debug menu is not included. The following example shows the statements that can be added to the resource-definition file to define the Debug menu:
MainMenu MENUBEGIN . . .#ifdef DEBUG POPUP "&Debug" BEGIN MENUITEM "&Memory usage", ID_MEMORY MENUITEM "&Walk data heap", ID_WALK_HEAP END#endifEND

When compiling resources for a debugging version of the application, you could include the Debug menu by using the following RC command:
rc -d DEBUG myapp.rc

To compile resources for a normal version of the application¾one that does not include the Debug menu¾you could use the following RC command:
rc myapp.rc

+$#K{bmc bm0.BMP}%XVELT1>index2
Renaming the Compiled Resource File
By default, when compiling resources, RC names the compiled resource (.RES) file with the base name of the .RC file and places it in the same directory as the .RC file. CVTRES must then be invoked to convert the .RES file to a binary resource format which can be understood by the linker (.RBJ). The following example compiles MYAPP.RC and creates a compiled resource file named MYAPP.RES in the same directory as MYAPP.RC:
rc myapp.rc

The /fo option lets you give the resulting .RES file a name that differs from the name of the corresponding .RC file. For example, to name the resulting .RES file NEWFILE.RES, you would use the following command:
rc -fo newfile.res myapp.rc

The /fo option can also place the .RES file in a different directory. For example, the following command places the compiled resource file MYAPP.RES in the directory C:\SOURCE\RESOURCE:
rc -fo c:\source\resource\myapp.res myapp.rc

+$#K{bmc bm0.BMP}%XVELT1>index2
Searching for Files
By default, RC searches for header files and resource files (such as icon and cursor files) first in the current directory and then in the directories specified by the INCLUDE environment variable. (The PATH environment variable has no effect on which directories RC searches.)
Adding a Directory to Search
You can use the /i option to add a directory to the list of directories RC searches. The compiler then searches the directories in the following order:
1. The current directory
2. The directory or directories you specify by using the /i option, in the order in which they appear on the RC command line
3. The list of directories specified by the INCLUDE environment variable, in the order in which the variable lists them, unless you specify the /x option

The following example compiles the resource-definition file MYAPP.RC:
rc /i c:\source\stuff /i d:\resources myapp.rc

When compiling the script MYAPP.RC, RC searches for header files and resource files first in the current directory, then in C:\SOURCE\STUFF and D:\RESOURCES, and then in the directories specified by the INCLUDE environment variable.
Suppressing the INCLUDE Environment Variable
You can prevent RC from using the INCLUDE environment variable when determining the directories to search. To do so, use the /x option. The compiler then searches for files only in the current directory and in any directories you specify by using the /i option.
The following example compiles the script file MYAPP.RC:
rc /x /i c:\source\stuff myapp.rc

When compiling the script MYAPP.RC, RC searches for header files and resource files first in the current directory and then in C:\SOURCE\STUFF. It does not search the directories specified by the INCLUDE environment variable.
+$#K{bmc bm0.BMP}%XVELT1>index2
Displaying Progress Messages
By default, RC compiles quietly. It does not display messages that report on its progress. You can, however, specify that RC is to display these messages. To do so, use the /v option.
The following example causes RC to report on its progress as it compiles the resource-definition file SAMPLE.RC and creates the compiled resource file SAMPLE.RES:
rc /v sample.rc

+$#K{bmc bm0.BMP}%XVELT1>index2
Resource-Definition Statements
This section describes the statements that define the resources that the Resource Compiler puts in the resource (.RES) file. Once a resource is linked to the executable file, the application can load the resource as it is needed at run time.
All resource statements associate an identifying name or number with a given resource.
Common Statement ParametersXZYYJY
Common Resource AttributesG1NESG
ACCELERATORS Resource7GJLS6
AUTO3STATE Control132D4.2
AUTOCHECKBOX ControlFAUEF2
AUTORADIOBUTTON ControlH7WDGT
BITMAP ResourceFEGV3M
CAPTION Statement95HK82
CHARACTERISTICS StatementAFGW2L
CHECKBOX ControlWBG55P
CLASS Statement_CLASS
COMBOBOX ControlK1H06L
CONTROL: General Control2HOARS5
CTEXT Control_CTEXT
CURSOR ResourceGQF1AO
DEFPUSHBUTTON Control4ADGGCT
DIALOG ResourceHE4UAD
DIALOGEX Resource7W8NNW
EDITTEXT Control3FI5BP5
EXSTYLE StatementNGP1DO
FONT Resource.OJEZW
FONT Statement_FONT
GROUPBOX Control2BCDXGQ
ICON Resource_ICON
ICON Control5_DK_8.
LANGUAGE StatementKMK1GX
LISTBOX Control10J9ILS
LTEXT Control_LTEXT
MENU Resource_MENU
MENU Statement_1CYE9
MENUEX StatementZ0W4TO
MENUITEM Statement3VT9D3
MESSAGETABLE Resource1.XLR0G
POPUP Resource_POPUP
PUSHBOX Control3UNM_T
PUSHBUTTON ControlJW7TB5
RADIOBUTTON Control7IC1FN
RCDATA95VJYY
RTEXT Control_RTEXT
SCROLLBAR ControlOHPDZB
STATE3 Control0FT2JK
STRINGTABLE Resource1UH1OD0
STYLE Statement1YH0I9
User-Defined Resource4MGN46
VERSION Statement.5OWYK
VERSIONINFO Resource3ZF2OI

+$#K{bmc bm0.BMP}%67UJIQ>index2
Common Statement Parameters
This section lists parameters in common among the resource or control statements. Occasionally, a certain statement will use a parameter differently, or may ignore a parameter. The statement-specific variation is described with the statement in the alphabetical reference.
Common Control Parameters
The general syntax for a control definition, and the meaning of each parameter is as follows:
control [text,] id, x, y, width, height [, style [, extended-style]]
Horizontal dialog units are 1/4 of the dialog base width unit. Vertical units are 1/8 of the dialog base height unit. The current dialog base units are computed from the height and width of the current system font. The GetDialogBaseUnits1.NE19N@api32wh.hlp function returns the dialog base units in pixels. The coordinates are relative to the origin of the dialog box.
Parameters
control
Keyword that indicates the ty pe of control being defined, such as PUSHBUTTON or CHECKBOX.
text
Specifies text that is displayed with the control. The text is positioned within the control's specified dimensions, or adjacent to the control.
This parameter must contain zero or more characters enclosed in double quotation marks. Strings are automatically null-terminated and converted to Unicode in the resulting resource file, except for strings specified in raw-data statements. (raw-data can be specified in RCDATA and user-defined resources.) To specify a Unicode string in raw-data, explicitly qualify the string as a wide-character string by using the L prefix.
By default, the characters listed between the double quotation marks are ANSI characters and escape sequences are interpreted as byte escape sequences. If the string is preceded by the L prefix, the string is a wide-character string and escape sequences are interpreted as two-byte escape sequences that specify Unicode characters. If a double quotation mark is required in the text, you must include the double quotation mark twice or use the \" escape sequence.
An ampersand (&) character in the text indicates that the following character is used as a mnemonic character for the control. When the control is displayed, the ampersand is not shown, but the mnemonic character is underlined. The user can choose the control by pressing the key corresponding to the underlined mnemonic character. To use the ampersand as a character in a string, insert two ampersands (&&).
id
Specifies the control identifier. This value must be a 16-bit unsigned integer in the range 0 through 65,535 or a simple arithmetic expression that evaluates to a value in that range.
x
Specifies the x-coordinate of the left side of the control relative to the left side of the dialog box. This value must be a 16-bit unsigned integer in the range 0 through 65,535. The coordinate is in dialog units and is relative to the origin of the dialog box, window, or control containing the specified control.
y
Specifies the y-coordinate of the top side of the control relative to the top of the dialog box. This value must be a 16-bit unsigned integer in the range 0 through 65,535. The coordinate is in dialog units relative to the origin of the dialog box, window, or control containing the specified control.
width
Specifies the width of the control. This value must be a 16-bit unsigned integer in the range 1 through 65,535. The width is in 1/4-character units.
height
Specifies the height of the control. This value must be a 16-bit unsigned integer in the range 1 through 65,535. The height is in 1/8-character units.
style
Specifies the control styles. Use the bitwise OR (|) operator to combine styles.
extended-style
Specifies extended (WS_EX_xxx) styles. You must specify a style to specify an extended-style. See also EXSTYLENGP1DO.

#text
Specifies text that is displayed with the control. The text is positioned within the control's specified dimensions, or adjacent to the control.
This parameter must contain zero or more characters enclosed in double quotation marks. Strings are automatically null-terminated and converted to Unicode in the resulting resource file, except for strings specified in raw-data statements. (raw-data can be specified in RCDATA and user-defined resources.) To specify a Unicode string in raw-data, explicitly qualify the string as a wide-character string by using the L prefix.
By default, the characters listed between the double quotation marks are ANSI characters and escape sequences are interpreted as byte escape sequences. If the string is preceded by the L prefix, the string is a wide-character string and escape sequences are interpreted as two-byte escape sequences that specify Unicode characters. If a double quotation mark is required in the text, you must include the double quotation mark twice or use the \" escape sequence.
An ampersand (&) character in the text indicates that the following character is used as a mnemonic character for the control. When the control is displayed, the ampersand is not shown, but the mnemonic character is underlined. The user can choose the control by pressing the key corresponding to the underlined mnemonic character. To use the ampersand as a character in a string, insert two ampersands (&&).
#id
Specifies the control identifier. This value must be a 16-bit unsigned integer in the range 0 through 65,535 or a simple arithmetic expression that evaluates to a value in that range.
#x
Specifies the x-coordinate of the left side of the control relative to the left side of the dialog box. This value must be a 16-bit unsigned integer in the range 0 through 65,535. The coordinate is in dialog units and is relative to the origin of the dialog box, window, or control containing the specified control.
#y
Specifies the y-coordinate of the top side of the control relative to the top of the dialog box. This value must be a 16-bit unsigned integer in the range 0 through 65,535. The coordinate is in dialog units relative to the origin of the dialog box, window, or control containing the specified control.
#width
Specifies the width of the control. This value must be a 16-bit unsigned integer in the range 1 through 65,535. The width is in 1/4-character units.
#height
Specifies the height of the control. This value must be a 16-bit unsigned integer in the range 1 through 65,535. The height is in 1/8-character units.
#style
Specifies the control styles. Use the bitwise OR (|) operator to combine styles.
#extended-style
Specifies extended (WS_EX_xxx) styles. You must specify a style to specify an extended-style. See also EXSTYLENGP1DO.
+$#K{bmc bm0.BMP}%67UJIQ>index2
Common Resource Attributes
All resource-definition statements include a load-mem option that specifies the loading and memory characteristics of the resource. These attributes are divided into two groups: load attributes and memory attributes. The only attribute that is used by Win32 is the DISCARDABLE attribute. The remaining attribute specifiers are allowed in the script for compatibility with existing scripts, but are ignored.
Load Attributes
The load attributes specify when the resource is to be loaded. The load parameter must be one of the following:
PRELOAD
Ignored. In 16-bit Windows, the resource is loaded with the executable file.
LOADONCALL
Ignored. In 16-bit Windows, the resource is loaded when called.

Memory Attributes
The memory attributes specify whether the resource is fixed or movable, whether it is discardable, and whether it is pure. The memory parameter can be one or more of the following:
FIXED
Ignored. In 16-bit Windows, the resource remains at a fixed memory location.
MOVEABLE
Ignored. In 16-bit Windows, the resource can be moved if necessary in order to compact memory.
DISCARDABLE
Resource can be discarded if no longer needed.
PURE
Ignored. Accepted for compatibility with existing resource scripts.
IMPURE
Ignored. Accepted for compatibility with existing resource scripts.

The default is DISCARDABLE for cursor, icon, and font resources.
+$#K{bmc bm0.BMP}%67UJIQ>index2
ACCELERATORS Resource
acctablename ACCELERATORS[optional-statements]BEGIN event, idvalue, [type] [options] . . .END
The ACCELERATORS statement defines one or more accelerators for an application. An accelerator is a keystroke defined by the application to give the user a quick way to perform a task. The TranslateAccelerator6.OA78@api32wh.hlp function is used to translate accelerator messages from the application queue into WM_COMMANDNGQ8ZR@api32wh.hlp or WM_SYSCOMMAND66A3FI@api32wh.hlp messages.
Parameters
acctablename
Specifies either a unique name or a 16-bit unsigned integer value that identifies the resource.
optional-statements
Zero or more of the following statements:
Statement Decription
CHARACTERISTICS dwordAFGW2L User-defined information about a resourc e that can be used by tools that read and write resource files.
LANGUAGE language, sublanguageKMK1GX Specifies the language f o r the re so urce. The parameters are constants from WINNLS.H.
VERSION dword.5OWYK User-defined version number for the reso u rce that can be used by tools that read and write resource files.

event
Specifies the keystroke to be used as an accelerator. It can be any one of the following character types:
"char"
A single character enclosed in double quotation marks. The character can be preceded by a caret (^), meaning that the character is a control character.
Character
An integer value representing a character. The type parameter must be ASCII.
Virtual-key character
An integer value representing a virtual key. The virtual key for alphanumeric keys can be specified by placing the uppercase letter or number in double quotation marks (for example, "9" or "C"). The type parameter must be VIRTKEY.

idvalue
Specifies a 16-bit unsigned integer value that identifies the accelerator.
type
Required only when the event parameter is a character or a virtual-key character. The type parameter specifies either ASCII or VIRTKEY; the integer value of event is interpreted accordingly. When VIRTKEY is specified and event contains a string, event must be uppercase.
options
Specifies the options that define the accelerator. This parameter can be one or more of the following values:
NOINVERT
Specifies that no top-level menu item is highlighted when the accelerator is used. This is useful when defining accelerators for actions such as scrolling that do not correspond to a menu item. If NOINVERT is omitted, a top-level menu item will be highlighted (if possible) when the accelerator is used.
ALT
Causes the accelerator to be activated only if the ALT key is down.
SHIFT
Causes the accelerator to be activated only if the SHIFT key is down.
CONTROL
Defines the character as a control character (the accelerator is only activated if the CONTROL key is down). This has the same effect as using a caret (^) before the accelerator character in the event parameter.

The ALT, SHIFT, and CONTROL options apply only to virtual keys.
Example
The following example demonstrates the use of accelerator keys:
1 ACCELERATORSBEGIN "^C", IDDCLEAR ; control C "K", IDDCLEAR ; shift K "k", IDDELLIPSE, ALT ; alt k 98, IDDRECT, ASCII ; b 66, IDDSTAR, ASCII ; B (shift b) "g", IDDRECT ; g "G", IDDSTAR ; G (shift G) VK_F1, IDDCLEAR, VIRTKEY ; F1 VK_F1, IDDSTAR, CONTROL, VIRTKEY ; control F1 VK_F1, IDDELLIPSE, SHIFT, VIRTKEY ; shift F1 VK_F1, IDDRECT, ALT, VIRTKEY ; alt F1 VK_F2, IDDCLEAR, ALT, SHIFT, VIRTKEY ; alt shift F2 VK_F2, IDDSTAR, CONTROL, SHIFT, VIRTKEY ; ctrl shift F2 VK_F2, IDDRECT, ALT, CONTROL, VIRTKEY ; alt control F2END

See Also
TranslateAccelerator6.OA78@api32wh.hlpMultiline Statements1VYW4OOCHARACTERISTICSAFGW2L, LANGUAGEKMK1GX, VERSION.5OWYKACCELERATORS7GJLS6, DIALOGHE4UAD, MENU_MENU, RCDATA95VJYY, STRINGTABLE1UH1OD0
+$#K{bmc bm0.BMP}%67UJIQ>index2
AUTO3STATE Control
AUTO3STATE text_TEXT, id_ID, x_X, y_Y, width_WIDTH, heightLA.P0Q [, style_STYLE [, extended-styleC6RBWW]]
The AUTO3STATE statement creates an automatic 3-state check box. The control is an open box with the given text positioned to the right of the box. When chosen, the box automatically advances between three states: checked, unchecked, and disabled (grayed). The control sends a message to its parent whenever the user chooses the control.
Parameters
style
Specifies styles for the control, which can be a combination of th e BS_AUTO3STATEG9DOWG@api32wh.hlp style and the following styles: WS_TABSTOP19PJ04J@api32wh.hlp, WS_DISABLEDXHC9I.@api32wh.hlp, and WS_GROUP5Q7E73@api32wh.hlp.
The default style for this control is BS_AUTO3STATE and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "Common Statement ParametersXZYYJY".
See Also
AUTOCHECKBOXFAUEF2, CHECKBOXWBG55P, CONTROL2HOARS5, STATE30FT2JK

+$#K{bmc bm0.BMP}%67UJIQ>index2
AUTOCHECKBOX Control
AUTOCHECKBOX text_TEXT, id_ID, x_X, y_Y, width_WIDTH, heightLA.P0Q [, style_STYLE [, ex tended-styleC6RBWW]]
The AUTOCHECKBOX statement creates an automatic check box control. The control is a small rectangle (check box) that has the specified text displayed next to it (typically, to the right). When the user chooses the control, the control highlights the rectangle and sends a message to its parent window. The AUTOCHECKBOX statement, which can only be used in the body of a DIALOGHE4UAD statement, defines the text, identifier, dimensions, and attributes of the control.
Parameters
style
Specifies the styles of the control. This value can be a combinatio n of the button class style BS_AUTOCHECKBOX_UAKWO@api32wh.hlp and the WS_TABSTOP19PJ04J@api32wh.hlp and WS_GROUP5Q7E73@api32wh.hlp styles.
If you do not specify a style, the default style is BS_AUTOCHECKBOX and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "Common Statement ParametersXZYYJY".
See Also
AUTO3STATE132D4.2, CHECKBOXWBG55P, CONTROL2HOARS5, STATE30FT2JK

+$#K{bmc bm0.BMP}%67UJIQ>index2
AUTORADIOBUTTON Control
AUTORADIOBUTTON text_TEXT, id_ID, x_X, y_Y, width_WIDTH, heightLA.P0Q [, style_STYLE [, extended-styleC6RBWW]]
The AUTORADIOBUTTON control statement specifies an automatic radio button control. This control automatically performs mutual exclusion with the other AUTORADIOBUTTON controls in the same group. When the button is chosen, the application is notified with BN_CLICKED3IB15J@api32wh.hlp
Parameters
text
The specified text appears next to the radio button.
style
Specifies styles for the automatic radio button, which can be a combination of BUTTON-class styles and the following styles: WS_TABSTOP19PJ04J@api32wh.hlp, WS_DISABLEDXHC9I.@api32wh.hlp, and WS_GROUP5Q7E73@api32wh.hlp.
The default style for AUTORADIOBUTTON is BS_AUTORADIOBUTTON and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "Common Statement ParametersXZYYJY".
See Also
CONTROL2HOARS5, RADIOBUTTON7IC1FN
+$#K{bmc bm0.BMP}%67UJIQ>index2
BITMAP Resource
nameID BITMAP [load-mem] filename
The BITMAP resource-definition statement specifies a bitmap that an application uses in its screen display or as an item in a menu or control.
Parameters
nameID
Specifies either a unique name or a 16-bit unsigned integer value id entifying the resource.
load-mem
Specifies loading and memory attributes for the resource. For more information, see "Common Resource AttributesG1NESG".
filename
Specifies the name of the file that contains the resource. The name must be a valid filename; it must be a full path if the file is not in the current working directory. The path can either be a quoted or non-quoted string.

Example
The following example specifies two bitmap resources:
disk1 BITMAP disk.bmp12 BITMAP PRELOAD diskette.bmp

See Also
LoadBitmap
+$#K{bmc bm0.BMP}%67UJIQ>index2
CAPTION Statement
CAPTION captiontext
The CAPTION statement defines the title for a dialog box. The title appears in the box's caption bar (if it has one).
The default caption is empty.
Parameter
captiontext
Specifies a character string enclosed in double quotation marks.

Example
The following example demonstrates the use of the CAPTION statement:
CAPTION "Error!"

+$#K{bmc bm0.BMP}%67UJIQ>index2
CHARACTERISTICS Statement
CHARACTERISTICS dword
The CHARACTERISTICS statement allows the developer to specify information about a resource that can be used by tools that read and write resource-definition files. The specified dword value appears with the resource in the compiled .RES file. However, the value is not stored in the executable file and has no significance to Windows.
The CHARACTERISTICS statement appears before the BEGIN in an ACCELERATORS, DIALOG, MENU, RCDATA, or STRINGTABLE resource definition. The specified value applies only to that resource.
Parameter
dword
A user-defined doubleword value.

See Also
Multiline Statements1VYW4OOCH ARACTERISTICSAFGW2L, LANGUAGEKMK1GX, VERSION.5OWY KACCELERATORS7GJLS6, DIALOGHE4UAD, MENU_MENU, RCDATA95VJYY, STRINGTABLE1UH1OD0
+$#K{bmc bm0.BMP}%67UJIQ>index2
CHECKBOX Control
CHECKBOX text_TEXT, id_ID, x_X, y_Y, width_WIDTH, heightLA.P0Q [, style_STYLE [, extended-styleC6RBWW]]
The CHECKBOX statement creates a check box control. The control is a small rectangle (check box) that has the specified text displayed next to it (typically, to the right). When the user selects the control, the control highlights the rectangle and sends a message to its parent window. The CHECKBOX statement, which can only be used in a DIALOG statement, defines the text, identifier, dimensions, and attributes of the control.
Parameters
text
Specifies text that is displayed to the right of the control.
style
Specifie s the control styles. This value can be a combination of the button class style BS_CHECKBOX and the WS_TABSTOP and WS_GROUP styles.
If you do not specify a style, the default style is BS_CHECKBOX and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "Common Statement ParametersXZYYJY".

Example
This example creates a check-box control that is labeled "Italic":
CHECKBOX "Italic", 3, 10, 10, 40, 10

See Also
AUTOCHECKBOX, AUTO3STATE, STATE3, GetDialogBaseUnits1.NE19N@api32wh.hlp
+$#K{bmc bm0.BMP}%67UJIQ>index2
CLASS Statement
CLASS class
The CLASS statement defines the class of the dialog box. The CLASS statement appears in the optional section before a DIALOG statement's BEGIN keyword. If no class is given, the Windows standard dialog class is used.
Parameters
class
Specifies a 16-bit unsigned integer or a string, enclosed in double quotatio n marks, that identifies the class of the dialog box. If the window procedure for the class does not process a message sent to it, it must call the DefDlgProc function to ensure that all messages are handled properly for the dialog box. A private class can use DefDlgProc1UQ5KJK@api32wh.hlp as the default window procedure. The class must be registered with the cbWndExtra member of the WNDCLASS27Z3WP@api32wh.hlp structure set to DLGWINDOWEXTRA.

Comments
The CLASS statement should only be used with special cases, since it overrides the normal processing of a dialog box. The CLASS statement converts a dialog box to a window of the specified class; depending on the class, this could give undesirable results. Do not use the redefined control-class names with this statement.
Example
The following example demonstrates the use of the CLASS statement:
CLASS "myclass"

See Also
DIALOGHE4UAD, DefDlgProc1UQ5KJK@api32wh.hlp
+$#K{bmc bm0.BMP}%67UJIQ>index2
COMBOBOX Control
COMBOBOX text_TEXT, id_ID, x_X, y_Y, width_WIDTH, heightLA.P0Q [, style_STYLE [, extended-styleC6RBWW]]
The COMBOBOX statement creates a combination box control (a combo box). A combo box consists of either a static text box or an edit box combined with a list box. The list box can be displayed at all times or pulled down by the user. If the combo box contains a static text box, the text box always displays the selection (if any) in the list box portion of the combo box. If it uses an edit box, the user can type in the desired selection; the list box highlights the first item (if any) that matches what the user has entered in the edit box. The user can then select the item highlighted in the list box to complete the choice. In addition, the combo box can be owner-drawn and of fixed or variable height.
Parameters
style
Specifies the control styles. This value can be a combination of the COMBOBOX class styles and any of the following styles: WS_TABSTOP, WS_GROUP, WS_VSCROLL, and WS_DISABLED.
If you do not specify a style, the default style is CBS_SIMPLE and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "Common Statement ParametersXZYYJY".
Example
This example creates a combo-box control with a vertical scroll bar:
COMBOBOX 777, 10, 10, 50, 54, CBS_SIMPLE | WS_VSCROLL | WS_TABSTOP

+$#K{bmc bm0.BMP}%67UJIQ>index2
CONTROL: General Control
CONTROL text_TEXT, id_ID, class, style, x_X, y_Y, width_WIDTH, heightLA.P0Q [, extended-styleC6RBWW]
This statement defines a user-defined control window.
Parameters
class
Specifies a redefined name, character string, a 16-bit unsigned integer value that defines the class. This can be any one of the control classes; for a list of the control classes, see the first list following this description. If the value is a redefined name supplied by the application, it must be a string enclosed in double quotation marks.
style
Specifies a redefined name or integer value that specifies the style of the given control. The exact meaning of style depends on the class value. the sections following this description show the control classes and corresponding styles.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "Common Statement ParametersXZYYJY".
The six possible control classes are described in the following sections.
The Button Control Class
A button control is a small rectangular child window that represents a "button" that the user can turn on or off by clicking it with the mouse. Button controls can be used alone or in groups, and can either be labeled or appear without text. Button controls typically change appearance when the user clicks them.
A button can have only one of the following styles, with the exception of BS_LEFTTEXTBS, which can be combined with check boxes and radio buttons.
BS_3STATE
Creates a button that is the same as a check box, except that the box can be grayed (dimmed) as well as checked. The grayed state is used to show that the state of the check box is not determined.
BS_AUTO3STATE
Creates a button that is the same as a three-state check box, except that the box changes its state when the user selects it. The state cycles through checked, grayed, and normal.
BS_AUTOCHECKBOX
Creates a button that is the same as a check box, except that an X appears in the check box when the user selects the box; the X disappears (is cleared) the next time the user selects the box.
BS_AUTORADIOBUTTON
Creates a button that is the same as a radio button, except that when the user selects it, the button automatically highlights itself and clears (removes the selection from) any other buttons in the same group.
BS_CHECKBOX
Creates a small square that has text displayed to its right (unless this style is combined with the BS_LEFTTEXT style).
BS_DEFPUSHBUTTON
Creates a button that has a heavy black border. The user can select this button by pressing the ENTER key. This style is useful for enabling the user to quickly select the most likely option (the default option).
BS_GROUPBOX
Creates a rectangle in which other controls can be grouped. Any text associated with this style is displayed in the rectangle's upper-left corner.
BS_LEFTTEXT
Places text on the left side of the radio button or check box when combined with a radio button or check box style.
BS_OWNERDRAW
Creates an owner-drawn button. The owner window receives a WM_MEASUREITEM message when the button is created, and it receives a WM_DRAWITEM message when a visual aspect of the button has changed. The BS_OWNERDRAW style cannot be combined with any other button styles.
BS_PUSHBUTTON
Creates a push button that posts a WM_COMMAND message to the owner window when the user selects the button.
BS_RADIOBUTTON
Creates a small circle that has text displayed to its right (unless this style is combined with the BS_LEFTTEXT style). Radio buttons are usually used in groups of related but mutually exclusive choices.
The Combobox Control Class
Combo-box controls consist of a selection field similar to an edit control plus a list box. The list box may be displayed at all times or may be dropped down when the user selects a "pop box" next to the selection field.
Depending on the style of the combo box, the user can or cannot edit the contents of the selection field. If the list box is visible, typing characters into the selection box will cause the first list-box entry that matches the characters typed to be highlighted. Conversely, selecting an item in the list box displays the selected text in the selection field. Combo-box control styles are described below.
CBS_SIMPLE
Displays the list box at all times. The current selection in the list box is displayed in the edit control.
CBS_DROPDOWN
Similar to CBS_SIMPLE except that the list box is not displayed unless the user selects an icon next to the selection field.
CBS_DROPDOWNLIST
Similar to CBS_DROPDOWN except that the edit control is replaced by a static text item which displays the current selection in the list box.
CBS_OWNERDRAWFIXED
Specifies a fixed-height owner-draw combo box. The owner of the list box is responsible for drawing its contents; the items in the list box are all the same height.
CBS_OWNERDRAWVARIABLE
Specifies a variable-height owner-draw combo box. The owner of the list box is responsible for drawing its contents; the items in the list box can have different heights.
CBS_AUTOHSCROLL
Scrolls the text in the edit control to the right when the user types a character at the end of the line. If this style is not set, only text that fits within the rectangular boundary is allowed.
CBS_SORT
Sorts strings entered into the list box.
CBS_HASSTRINGS
Specifies an owner-draw combo box that contains items consisting of strings. The combo box maintains the memory and pointers for the strings so that the application can use the LB_GETTEXT message to retrieve the text for a particular item.
CBS_OEMCONVERT
Converts text entered in the combo box edit control from the ANSI character set to the OEM character set and then back to ANSI. This ensures proper character conversion when the application calls the CharToOem function to convert an ANSI string in the combo box to OEM characters. This style is most useful for combo boxes that contain filenames and applies only to combo boxes created with the CBS_SIMPLE or CBS_DROPDOWN styles.
The Edit Control Class
An edit control is a rectangular child window in which the user can enter text from the keyboard. The user selects the control, and gives it the input focus, by clicking the mouse inside it or pressing the TAB key. The user can enter text when the control displays a flashing insertion point. The mouse can be used to move the cursor and select characters to be replaced, or to position the cursor for inserting characters. The BACKSPACE key can be used to delete characters.
Edit controls use the fixed-pitch font and display Unicode characters. They expand tab characters into as many space characters as are required to move the cursor to the next tab stop. Tab stops are assumed to be at every eighth character position. Edit control styles are described below.
ES_LEFT
Justifies the text to the left.
ES_CENTER
Centers the text. This style is valid in multiline edit controls only.
ES_RIGHT
Justifies the text to the right. This style is valid in multiline edit controls only.
ES_LOWERCASE
Converts all characters to lowercase as they are typed into the edit control.
ES_UPPERCASE
Converts all characters to uppercase as they are typed into the edit control.
ES_PASSWORD
Displays all characters as an asterisk (*) as they are typed into the edit control. An application can use the EM_SETPASSWORDCHAR message to change the character that is displayed.
ES_MULTILINE
Multiple-line edit control. (The default is single-line.) Shows as many lines of text as possible. The following four styles specify options for horizontal and vertical scrolling.
ES_AUTOVSCROLL specified
Shows as many lines as possible and scrolls vertically when the user presses the ENTER key. (This is actually the carriage-return character, which the edit control expands to a carriage-return/line-feed combination.)
ES_AUTOVSCROLL not specified
Shows as many lines as possible and beeps if the user presses ENTER when no more lines can be displayed.
ES_AUTOHSCROLL specified
Scrolls horizontally when the insertion point goes past the right edge of the control. To start a new line, press the ENTER key.
ES_AUTOHSCROLL not specified
Wraps words to the beginning of the next line when necessary. A new line is also started if the user presses ENTER. If the window size changes, the word wrap position changes, and the text is redisplayed.
Multiple-line edit controls can have scroll bars. An edit control with scroll bars processes its own scroll-bar messages. Edit controls without scroll bars scroll as described above, and process any scroll messages sent by the parent window.
ES_AUTOVSCROLL
Scrolls text automatically up one page when the user presses the ENTER key on the last line.
ES_AUTOHSCROLL
Scrolls text automatically to the right by 10 characters when the user types a character at the end of the line. When the user presses the ENTER key, the control scrolls all text back to position 0.
ES_NOHIDESEL
Overrides the default action, in which an edit control hides the selection when the control loses the input focus. Inverts the selection instead.
ES_OEMCONVERT
Converts text entered in the edit control from the ANSI character set to the OEM character set and then back to ANSI. This ensures proper character conversion when the application calls the CharToOem function to convert an ANSI string in the edit control to OEM characters. This style is most useful for edit controls that contain filenames.
The Listbox Control Class
Listbox controls consist of a list of character strings. The control is used whenever an application needs to present a list of names, such as filenames, that the user can view and select. The user can select a string by pointing to the string with the mouse and clicking a mouse button. When a string is selected, it is highlighted and a notification message is passed to the parent window. A scroll bar can be used with a listbox control to scroll lists that are too long or too wide for the control window. Listbox control styles are described below.
LBS_STANDARD
Strings in the list box are sorted alphabetically and the parent window receives an input message whenever the user clicks or double-clicks a string. The list box contains borders on all sides.
LBS_DISABLENOSCROLL
Shows a disabled vertical scroll bar for the list box when the box does not contain enough items to scroll. If this style is not specified, the scroll bar is hidden when the list box does not contain enough items.
LBS_EXTENDEDSEL
The user can select multiple items using the mouse with the SHIFT and/or the CONTROL key or special key combinations.
LBS_HASSTRINGS
An owner-draw list box contains items consisting of strings. The list box maintains the memory and pointers for the strings so the application can use the LB_GETTEXT message to retrieve the text for a particular item.
LBS_NOTIFY
The parent receives an input message whenever the user clicks or double-clicks a string.
LBS_MULTIPLESEL
The string selection is toggled each time the user clicks or double-clicks the string. Any number of strings can be selected.
LBS_MULTICOLUMN
The list box contains multiple columns. The list box can be scrolled horizontally. The LB_SETCOLUMNWIDTH message sets the width of the columns.
LBS_NOINTEGRALHEIGHT
The size of the list box is exactly the size specified by the application when it created the list box. Normally, Windows sizes a list box so that the list box does not display partial items.
LBS_SORT
The strings in the list box are sorted alphabetically.
LBS_NOREDRAW
The list-box display is not updated when changes are made. This style can be changed at any time by sending a WM_SETREDRAW message.
LBS_OWNERDRAWFIXED
The owner of the list box is responsible for drawing its contents; the items in the list box are all the same height.
LBS_OWNERDRAWVARIABLE
The owner of the list box is responsible for drawing its contents; the items in the list box are variable in height.
LBS_USETABSTOPS
The list box is able to recognize and expand tab characters when drawing its strings. The default tab positions are set at every 32 dialog units. (A dialog unit is a horizontal or vertical distance. One horizontal dialog unit is equal to 1/4 of the current dialog base width unit. The dialog base units are computed from the height and width of the current system font. The GetDialogBaseUnits1.NE19N@api32wh.hlp function returns the size of the dialog base units in pixels.)
LBS_WANTKEYBOARDINPUT
The owner of the list box receives WM_VKEYTOITEM or WM_CHARTOITEM messages whenever the user presses a key when the list box has input focus. This allows an application to perform special processing on the keyboard input.
The Scrollbar Control Class
A scroll-bar control is a rectangle that contains a scroll thumb and has direction arrows at both ends. The scroll bar sends a notification message to its parent whenever the user clicks the mouse in the control. The parent is responsible for updating the thumb position, if necessary. Scroll-bar controls have the same appearance and function as the scroll bars used in ordinary windows. But unlike scroll bars, scroll-bar controls can be positioned anywhere within a window and used whenever needed to provide scrolling input for a window. Scroll bar control styles are described below.
SBS_VERT
Vertical scroll bar. If neither SBS_RIGHTALIGN nor SBS_LEFTALIGN is specified, the scroll bar has the height, width, and position given in the CreateWindow54QQRO@api32wh.hlp function.
SBS_RIGHTALIGNDBP07U@api32wh.hlp
Used with SBS_VERT. The right edge of the scroll bar is aligned with the right edge of the rectangle specified by the x, y, width, and height values given in the CreateWindow54QQRO@api32wh.hlp function. The scroll bar has the default width for system scroll bars.
SBS_LEFTALIGN
Used with SBS_VERT. The left edge of the scroll bar is aligned with the left edge of the rectangle specified by the x, y, width, and height values given in the CreateWindow54QQRO@api32wh.hlp function. The scroll bar has the default width for system scroll bars.
SBS_HORZ
Horizontal scroll bar. If neither SBS_BOTTOMALIGN nor SBS_TOPALIGN is specified, the scroll bar has the height, width, and position given in the CreateWindow54QQRO@api32wh.hlp function.
SBS_TOPALIGN
Used with SBS_HORZ. The top edge of the scroll bar is aligned with the top edge of the rectangle specified by the x, y, width, and height values given in the CreateWindow54QQRO@api32wh.hlp function. The scroll bar has the default height for system scroll bars.
SBS_BOTTOMALIGN
Used with SBS_HORZ. The bottom edge of the scroll bar is aligned with the bottom edge of the rectangle specified by the x, y, width, and height values given in the CreateWindow54QQRO@api32wh.hlp function. The scroll bar has the default height for system scroll bars.
SBS_SIZEBOX
Size box. If neither SBS_SIZEBOXBOTTOMRIGHTALIGN nor SBS_SIZEBOXTOPLEFTALIGN is specified, the size box has the height, width, and position given in the CreateWindow54QQRO@api32wh.hlp function.
SBS_SIZEBOXTOPLEFTALIGN
Used with SBS_SIZEBOX. The top-left corner of the size box is aligned with the top-left corner of the rectangle specified by the x, y, width, and height values given in the CreateWindow54QQRO@api32wh.hlp function. The size box has the default size for system size boxes.
SBS_SIZEBOXBOTTOMRIGHTALIGN
Used with SBS_SIZEBOX. The bottom-right corner of the size box is aligned with the bottom-right corner of the rectangle specified by the x, y, width, and height values given in the CreateWindow54QQRO@api32wh.hlp function. The size box has the default size for system size boxes.
The Static Control Class
Static controls are simple text fields, boxes, and rectangles that can be used to label, box, or separate other controls. Static controls take no input and provide no output. Static control styles are described below.
SS_LEFT
A simple rectangle displaying the given text flush left. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line.
SS_CENTER
A simple rectangle displaying the given text centered. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line.
SS_RIGHT
A simple rectangle displaying the given text flush right. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line.
SS_LEFTNOWORDWRAP
A simple rectangle displaying the given text flush left. Tabs are expanded, but words are not wrapped. Text that extends past the end of a line is clipped.
SS_SIMPLE
A simple rectangle with a single line of text flush left. The line of text cannot be shortened or altered in any way. (The control's parent window or dialog box must not process the WM_CTLCOLOR message.)
SS_NOPREFIX
Removes any (&) characters and underlines the next character in the string. Unless this style is specified, Windows will interpret any (&) characters in the control's text to be accelerator prefix characters. If a static control is to contain text where this feature is not wanted, SS_NOPREFIX may be added. This STATIC-control style may be included with any of the defined STATIC controls.
You can combine SS_NOPREFIX with other styles by using the bitwise OR operator. This is most often used when filenames or other strings that may contain an (&) need to be displayed in a static control in a dialog box.
SS_ICON
An icon displayed in the dialog box. The given text is the name of an icon (not a filename) defined elsewhere in the resource file. For the ICON statement, the width and height parameters in the CreateWindow54QQRO@api32wh.hlp function are ignored; the icon automatically sizes itself.
SS_BLACKRECT
A rectangle filled with the color used to draw window frames. This color is black in the default Windows color scheme.
SS_GRAYRECT
A rectangle filled with the color used to fill the screen background. This color is gray in the default Windows color scheme.
SS_WHITERECT
A rectangle filled with the color used to fill window backgrounds. This color is white in the default Windows color scheme.
SS_BLACKFRAME
Box with a frame drawn with the same color as window frames. This color is black in the default Windows color scheme.
SS_GRAYFRAME
Box with a frame drawn with the same color as the screen background (desktop). This color is gray in the default Windows color scheme.
SS_WHITEFRAME
Box with a frame drawn with the same color as window backgrounds. This color is white in the default Windows color scheme.
SS_USERITEM
User-defined item.

+$#K{bmc bm0.BMP}%67UJIQ>index2
CTEXT Control
CTEXT text_TEXT, id_ID, x_X, y_Y, width_WIDTH, heightLA.P0Q [, style_STYLE [, extended-styleC6RBWW]]
The CTEXT statement creates a centered-text control. The control is a simple rectangle displaying the given text centered in the rectangle. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line. The CTEXT statement, which you can use only in a DIALOG statement, defines the text, identifier, dimensions, and attributes of the control.
Parameters
text
Specifies text that is centered in the rectangular area of the control.
style
Sp ecifies the control styles. This value can be any combination of the following styles: SS_CENTER, WS_TABSTOP, and WS_GROUP.
If you do not specify a style, the default style is SS_CENTER and WS_GROUP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "Common Statement ParametersXZYYJY".
Example
This example creates a centered-text control that is labeled "filename":
CTEXT "filename", 101, 10, 10, 100, 100

See Also
CONTROL2HOARS5, DIALOGHE4UAD, LTEXT_LTEXT, RTEXT_RTEXT
+$#K{bmc bm0.BMP}%67UJIQ>index2
CURSOR Resource
nameID CURSOR [load-memG1NESG] filename
The CURSOR statement specifies a bitmap that defines the shape of the cursor on the display screen.
Parameters
nameID
Specifies either a unique name or a 16-bit unsigned integer identifying the res ource.
load-mem
Specifies loading and memory attributes for the resource. For more information, see "Common Resource AttributesG1NESG".
filename
Specifies the name of the file that contains the resource. The name must be a valid filename; it must be a full path if the file is not in the current working directory. The path can either be a quoted or non-quoted string.

Comments
Icon and cursor resources can contain more than one image. If the resource is marked with the PRELOAD option, Windows loads all images in the resource when the application executes.
Example
The following example specifies two cursor resources; one by name (cursor1) and the other by number (2):
cursor1 CURSOR bullseye.cur2 CURSOR "d:\\cursor\\arrow.cur"

+$#K{bmc bm0.BMP}%67UJIQ>index2
DEFPUSHBUTTON Control
DEFPUSHBUTTON text_TEXT, id_ID, x_X, y_Y, width_WIDTH, heightLA.P0Q [, style_STYLE [, extended-styleC6RBWW]]
The DEFPUSHBUTTON statement creates a default push-button control. The control is a small rectangle with a bold outline that represents the default response for the user. The given text is displayed inside the button. The control highlights the button in the usual way when the user clicks the mouse in it and sends a message to its parent window.
Parameters
text
Specifies text that is centered in the rectangular area of the control.
style
Speci fies the control styles. This value can be a combination of the following styles: BS_DEFPUSHBUTTON, WS_TABSTOP, WS_GROUP, and WS_DISABLED.
If you do not specify a style, the default style is BS_DEFPUSHBUTTON and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "Common Statement ParametersXZYYJY".
Example
This example creates a default push-button control that is labeled "Cancel":
DEFPUSHBUTTON "Cancel", 101, 10, 10, 24, 50

See Also
PUSHBUTTONJW7TB5, RADIOBUTTON7IC1FN
+$#K{bmc bm0.BMP}%67UJIQ>index2
DIALOG Resource
nameID DIALOG [load-memG1NESG] x_X, y_Y, width_WIDTH, heightLA.P0Q[optional-statements]BEGIN control-statement . . .END
The DIALOG statement defines a window that an application can use to create dialog boxes. The statement defines the position and dimensions of the dialog box on the screen as well as the dialog box style.
nameID
Identifies the dialog box. This is either a unique name or a unique 16-bit unsigned integer value in the range 1 to 65,535.
load-mem
Specifies loading and memory attributes for the resource. For more information, see "Common Resource AttributesG1NESG".
option-statements
Specifies options for the dialog box. This can be zero or more of the following statements:
CAPTION "text"
Specifies the caption of the dialog box if it has a title bar. See CAPTION95HK82 for more inf ormation.
CHARACTERISTICS dword
Specifies a user-defined double-word value for use by resource tools. This value is not u sed by Windows. For more information, see CHARACTERISTICSAFGW2L.
CLASS class
Specifies a 16-bit unsigned integer or a string, enclosed in double quotation marks, that identifies the class of the dialog box. See CLASS_CLASS for more information.
LANGUAGE language,sublanguage
Specifies the language of the dialog box. See LANGUAGEKMK1GX for more info rmation.
STYLE styles
Specifies the styles of the dialog box. See STYLE_STYLE for more information.
EXSTYLE=extended-styles
Specifies the extended styles of the dialog box. See EXSTYLENGP1DO for more information.
VERSION dword
Specifies a user-defined doubleword value. This statement is intended for use by additional resource tools and is not used by Windows. For more information, see VERSION.5OWYK.

For more information on the x, y, width, and height parameters, see "Common Statement ParametersXZYYJY".
Comments
The GetDialogBaseUnits1.NE19N@api32wh.hlp function returns the dialog base units in pixels. The exact meaning of the coordinates depends on the style defined by the STYLE option statement. For child-style dialog boxes, the coordinates are relative to the origin of the parent window, unless the dialog box has the style DS_ABSALIGN; in that case, the coordinates are relative to the origin of the display screen.
Do not use the WS_CHILD style with a modal dialog box. The DialogBox35ZS9S8@api32wh.hlp function always disables the parent/owner of the newly created dialog box. When a parent window is disabled, its child windows are implicitly disabled. Since the parent window of the child-style dialog box is disabled, the child-style dialog box is too.
If a dialog box has the DS_ABSALIGNGQJC31@api32wh.hlp style, the dialog coordinates for its upper-left corner are relative to the screen origin instead of to the upper-left corner of the parent window. You would typically use this style when you wanted the dialog box to start in a specific part of the display no matter where the parent window may be on the screen.
The name DIALOG can also be used as the class-name parameter to the CreateWindow54QQRO@api32wh.hlp function to create a window with dialog box attributes.
Example
The following demonstrates the usage of the DIALOG statement:
#include <windows.h>ErrorDialog DIALOG 10, 10, 300, 110STYLE WS_POPUP|WS_BORDERCAPTION "Error!"BEGIN CTEXT "Select One:", 1, 10, 10, 280, 12 PUSHBUTTON "&Retry", 2, 75, 30, 60, 12 PUSHBUTTON "&Abort", 3, 75, 50, 60, 12 PUSHBUTTON "&Ignore", 4, 75, 80, 60, 12END

See Also
CONTROL2HOARS5, CreateDialog11G1XV4@api32wh.hlp, CreateWindow54QQRO@api32wh.hlp, DialogBox35ZS9S8@api32wh.hlp, GetDialogBaseUnits1.NE19N@api32wh.hlpMultiline Statements1VYW4OOCHARACTERISTICSAFGW2L, LANGUAGEKMK1GX, VERSION.5OWYKACCELERATORS7GJLS6, DIALOGHE4UAD, MENU_MENU, RCDATA95VJYY, STRINGTABLE1UH1OD0
+$#K{bmc bm0.BMP}%67UJIQ>index2
DIALOGEX Resource
The DIALOGEX resource is an extension of the DIALOG resource. In addition to the functionality offered by DIALOG, DIALOGEX allows for the following:
· Help IDs on the dialog itself as well as on controls within the dialog.
· Use of the EXSTYLE statement for the dialog itself as well as on controls within the dialog.
· Font weight and italic settings for the font to be used in the dialog.
· Control-specific data for controls within the dialog.
· Use of the BEDIT, IEDIT, and HEDIT predefined system class names.

Syntax
nameID DIALOGEX [ load-mem] x, y, width, height [ , helpID][ optional-statements]BEGIN control-statement . . .END
Parameters
nameI D
I dentifi es the dialo g box. This is either a unique name or a unique 16-bit unsigned integer value in the r ange 1 to 65,535.
load-mem
Specifies loading and memory attributes for the resource. For more information, see Common Resource AttributesG1NESG.
x
Specifies the location on the screen of the left side of the dialog, in dialog units.
y
Specifies the location on the screen of the top of the dialog, in dialog units.
width
Specifies the width of the dialog, in dialog units.
height
Specifies the height of the dialog, in dialog units.
helpID
Specifies a numeric expression indicating the ID used to identify the dialog during WM_HELP processing.
optional-statements
Specifies options for the dialog box. This can be zero or more of the following statements:
CAPTION "text"
Specifies the caption of the dialog box if it has a title bar. See CAPTION95HK82 for more information.
CHARACTERISTICS DWORD
Specifies a user-defined DWORD value for use by resource tools. This value is not used by Windows. For more information see CHARACTERISTICSAFGW2L
CLASS class
Specifies a 16-bit unsigned integer or a string, enclosed in double quotation marks ("), that identifies the class of the dialog box. See CLASS_CLASS for more information.
EXSTYLE=extended-styles
Specifies the extended styles of the dialog box. See EXSTYLENGP1DO for more information.
FONT poi ntsize, typeface, weight, italic
pointsize
Specifies the size, in points, of the font.
typeface
Specifies t he name of the typeface. This name must be identical to the name defined in the [FONTS] section of WIN.INI. This parameter must be enclosed in double quotation marks (").
weight
Specifies a numeric expression for the font weight (explicit FW_* values defined in WINGDI.H can be used by adding an include to the RC file: #include "WINGDI.H")
italic
Indicates whether the font should be italic or not. Specify either TRUE or FALSE for the italic value.
LANGUAGE language, sublanguage
Specifies the language of the dialog box. See LANGUAGEKMK1GX for more information.
MENU menu name
Specifies the menu to use. This value is either the name of the menu or the integer identifier.
STYLE sty les
Specifies the styles of the dialog box. See STYLE1YH0I9 for more information.
VERSION DWORD
Specifies a use r-defined DWORD value. This statement is intended for use by additional resource tools and is not used by Windows. For more information, see VERSION.5OWYK
The DIALOGEX body is marked with a BEGIN statement at the beginning of the body and an END statement at the end of the body. The body is made up of any number of control statements. There are four families of control statements: generic, static, button, and edit. While each of these families uses a different syntax for defining specific features of its controls, they all share a common syntax for defining the position, size, extended styles, help identification number, and control-specific data. That common syntax is:
(controlType), x, y, cx, cy [, [exStyle] [, helpID] [BEGIN data-element-1 [, data-element-2 [, ... ]] E ND]
(co ntrolType)
Famil y-spe cific definition ¾ described below.
x
Specifies the location in the dialog of the left side of the control, in dialog units.
y
Specifies the location in the dialog of the top of the control, in dialog units.
cx
Specifies the width of the control, in dialog units.
cy
Specifies the height of the control, in dialog units.
exStyle
Specifies any number of extended window styles (explicit WS_EX_* style values defined in winuser.h can be used by adding an include to the RC file: #include "winuser.h")
helpID
Specifies a numeric expression indicating the ID used to identify the control during WM_HELP processing.
controlData
Marked by a nested BEGIN and END, specifies the control-specific data for the control. When a dialog is created, and a control in that dialog which has control-specific data is created, a pointer to that data is passed into the control's window procedure via the lParam to the WM_CREATE message for that control.

Following is the family-specific syntax of the (controlType):
Generic control:
CONTROL controlText, id, className, style
controlText
Specifies the window text for the control. For more information, see Common Statemen t Pa ra metersXZY YJ Y.
id
Specifies the control identifier. For more information, see Common Statement ParametersXZYYJY.
className
Specifies the name of the class. This may be either a string enclosed in double quotation marks (") or one of the following predefined system classes: BUTTON, STATIC, EDIT, LISTBOX, SCROLLBAR, or COMBOBOX.
style
Specifies the window styles (explicit WS_*, BS_*, SS_*, ES_*, LBS_*, SBS_*, and CBS_* style values defined in WINUSER.H can be used by adding an include to the RC file: #include "WINUSER.H")

Static control:
staticClass controlText, id
staticClass {LTEXT | RTEXT | CTEXT}

controlText
Specifies the window text for the control. For more information, see "Common Statement Parameters".
id
Specifies the control identifier. For more information, see "Common Statement Parameters".

Button control:
buttonClass controlText, id
buttonClass {AUTO3STATE | AUTOCHECKBOX | AUTORADIOBUTTON | CHECKBOX | PUSHBOX | PUSHBUTTON | RADIOBUTTON | STATE3 | USERBUTTON}

controlText
Specifies the window text for the control. For more information, see "Common Statement Parameters".
id
Specifies the control identifier. For more information, see "Common Statement Parameters".
Edit control:
editClass id
editClass {EDITTEXT | BEDIT | HEDIT | IEDIT}

id
Specifies the control identifier. For more information, see "Commo n Statement Parameters".
Arithmetic and Boolean Operations
Valid operations that may be contained in any of the numeric expressions in the statements of DIALOGEX are:
· Add ('+')
· Subtract ('-')
· Unary minus ('-')
· Unary NOT ('~')
· AND ('&')
· OR ('|')

See Also
CONTROL2HOARS5, CreateDialog11G1XV4@api32wh.hlp, CreateWindow54QQRO@api32wh.hlp, DialogBox35ZS9S8@api32wh.hlp, GetDialogBaseUnits1.NE19N@api32wh.hlp, Multiline Statements1VYW4OO, ACCELERATORS7GJLS6, CHARACTERISTICSAFGW2L, LANGUAGEKMK1GX, MENU_MENU, RCDATA95VJYY, STRINGTABLE1UH1OD0, VERSION.5OWYK
+$#K{bmc bm0.BMP}%67UJIQ>index2
EDITTEXT Control
EDITTEXT text_TEXT, id_ID, x_X, y_Y, width_WIDTH, heightLA.P0Q [, style_STYLE [, extended-styleC6RBWW]]
The EDITTEXT statement defines an EDIT control belonging to the EDIT class. It creates a rectangular region in which the user can type and edit text. The control displays a cursor when the user clicks the mouse in it. The user can then use the keyboard to enter text or edit the existing text. Editing keys include the BACKSPACE and DELETE keys. The user can also use the mouse to select characters to be deleted or to select the place to insert new characters.
Parameters
style
Specifies the control styles. This value can be a combination of the edit class styles and the following styles: WS_TABSTOP, WS_GROUP, WS_VSCROLL, WS_HSCROLL, and WS_DISABLED.
If you do not specify a style, the default style is ES_LEFT, WS_BORDER, and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "Common Statement ParametersXZYYJY".
Example
The following example demonstrates the use of the EDITTEXT statement:
EDITTEXT 3, 10, 10, 100, 10

+$#K{bmc bm0.BMP}%67UJIQ>index2
EXSTYLE Statement
EXSTYLE extended-style
The EXSTYLE command allows you to designate a dialog box with the WS_EX_style styles. In a resource defini tion, the EXSTYLE statement is placed with the optional statements before the BEGIN keyword. It can also be placed with the load-mem parameters in a DIALOG statement as follows:
name DIALOG [load-mem] EXSTYLE=extended-style x, y, ...
For controls, extended styles are specified after the style option in any control definition, a s follows:
contro l t ext, id, x, y, width, height, [style[, extended-style]]
Parameters
extended-style
The WS_EX_style style for the dialog box or control.

See also
ACCELERATORS7GJLS6, CONTROL2HOARS5, DIALOG HE4UAD, MENU_MENU, POPUP_POPUP, RCDATA95VJYY, STRINGTABLE1UH1OD0, User-Defined Resouce4MGN46
+$#K{bmc bm0.BMP}%67UJIQ>index2
FONT Resource
nameID FONT [load-memG1NESG] filename
The FONT resource-definition statement specifies a file that contains a font.
For a font resource, nameID must be a number; it cannot be a name.
Parameters
nameID
Specifies either a unique name or a 16-bit unsigned integer value identifying the resource.
load-mem
Specifies loa ding and memory attributes for the resource. For more information, see "Common Resource AttributesG1NESG".
filename
Specifies the name of the file that contains the resource. The name must be a valid filename; it must be a full path if the file is not in the current working directory. The path can either be a quoted or non-quoted string.

Example
The following example specifies a single font resource:
5 FONT CMROMAN.FNT

See also
FONT Statement_FONT
+$#K{bmc bm0.BMP}%67UJIQ>index2
FONT Statement
FONT pointsize, typeface
The FONT statement defines th e font with which Windows will draw text in the dialog box. The font must have been previously loaded, either from the WIN.INI file or by calling the LoadResource function.
Parameters
pointsize
Specifies the size, in points, of the font.
typeface
Specifies the name of the typeface. This name must be ident ical to the name defined in the [fonts] section of WIN.INI. This parameter must be enclosed in double quotes.

Example
The following example demonstrates the use of the FONT statement:
FONT 12, "MS Sans Serif"

See Also
DIALOGHE4UAD, FONT Resource.OJEZW, LoadResource1G7ONDP@api32wh.hlp
+$#K{bmc bm0.BMP}%67UJIQ>index2
GROUPBOX Control
GROUPBOX text_TEXT, id_ID, x_X, y_Y, width_WIDTH, heightLA.P0Q [, style_STYLE [, extended-styleC6RBWW]]
The GROUPBOX statement creates a group box control. The control is a rectangle that groups other controls together. The controls are grouped by drawing a border around them and displaying the given text in the upper-left corner. The GROUPBOX statement, which you can use only in a DIALOG statement, defines the text, identifier, dimensions, and attributes of a control window.
When the style contains WS_TABSTOP19PJ04J@api32wh.hlp or the text specifies an accelerator, tabbing or pressing the accelerator key moves the focus to the first control within the group.
Parameters
style
Specifies the control styles. This value can be a combination of the button class style BS_GROUPBOX and the WS_TABSTO P and WS_DISABLED styles.
If you do not specify a style, the default style is BS_GROUPBOX.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "Common Statement ParametersXZYYJY".
Example
This example creates a group-box control that is labeled Options:
GROUPBOX "Options", 101, 10, 10, 100, 100

See Also
DIALOGHE4UAD
+$#K{bmc bm0.BMP}%67UJIQ>index2
ICON Resource
nameID ICON [load-memG1NESG] filename
The ICON resource-definition statement specifies a bitmap that defines the shape of the icon to be used for a given application.
Parameters
nameID
Specifies either a unique name or a 16-bit unsigned integer value identifying the resource.
load-mem
Specifies loadin g and memory attributes for the resource. For more information, see "Common Resource AttributesG1NESG".
filename
Specifies the name of the file that contains the resource. The name must be a valid filename; it must be a full path if the file is not in the current working directory. The path can either be a quoted or non-quoted string.

Comments
Icon and cursor resources can contain more than one image. If the resource is marked as PRELOAD, Windows loads all images in the resource when the application executes.
Example
The following example specifies two icon resources:
desk1 ICON desk.ico11 ICON DISCARDABLE custom.ico

+$#K{bmc bm0.BMP}%67UJIQ>index2
ICON Control
ICON text_TEXT, id_ID, x_X, y_Y, [width_WIDTH, heightLA.P0Q, style_STYLE [, extended-styleC6RBWW]]
The ICON statement creates an icon control. This control is an icon displayed in a dialog box. The ICON control statement, which you can use only in a DIALOG statement, defines the icon-resource identifier, icon-control identifier, position, and attributes of a control.
Parameters
text
Specifies the name of an icon (not a filename) defined elsewhere in the resource file.
width
This value is ignored and sh ould be set to zero.
height
This value is ignored and should be set to zero.
style
Specifies the control style. This parameter is optional. The only value that can be specified is the SS_ICON style. This is the default style whether this parameter is specified or not.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "Common Statement ParametersXZYYJY".
Example
This example creates an icon control whose icon identifier is 901 and whose name is "myicon":
ICON "myicon" 901, 30, 30

See Also
DIALOGHE4UAD, ICON Resource_ICON
+$#K{bmc bm0.BMP}%67UJIQ>index2
LANGUAGE Statement
LANGUAGE language, sublanguage
The LANGUAGE statement sets the language for all resources up to the next LANGUAGE statement or to the end of the file. When the LANGUAGE statement appears before the BEGIN in an ACCELERATORS, DIALOG, MENU, RCDATA, or STRINGTABLE resource definition, the specified language applies only to that resource.
Parameters
language
Language identifier. Must be one of the constants from WINNLS.H
sublanguage
Sublanguage identifier. Must be one of the constants from WINNLS.H

See Also
Multiline Statements1VYW4OOCHARACTERISTICSAFGW2L, LANGUAGEKMK1GX, VERSION.5OWYKACCELERATORS7GJLS6, DIALOGHE4UAD, MENU_MENU, RCD ATA95VJYY, STRINGTABLE1UH1OD0
+$#K{bmc bm0.BMP}%67UJIQ>index2
LISTBOX Control
LISTBOX text_TEXT, id_ID, x_X, y_Y, width_WIDTH, heightLA.P0Q [, style_STYLE [, extended-styleC6RBWW]]
The LISTBOX statement creates commonly used controls for a dialog box or window. The control is a rectangle containing a list of strings (such as filenames) from which the user can select. The LISTBOX statement, which can only be used in a DIALOG or WINDOW statement, defines the identifier, dimensions, and attributes of a control window.
Parameters
style
Specifies the control styles. This value can be a combination of the list-box class styles and any of the following styles: WS_BORDERVIIT18@api32wh.hlp and WS_VSCROLL0N87_L@api32wh.hlp.
If you do not specify a style, the default style is LBS_NOTIFYHXY25A@api32wh.hlp and WS_BORDERVIIT18@api32wh.hlp.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "Common Statement ParametersXZYYJY".
Example
This example creates a list-box control whose identifier is 101:
LISTBOX 101, 10, 10, 100, 100

See Also
COMBOBOXK1H06L, DIALOGHE4UAD
+$#K{bmc bm0.BMP}%67UJIQ>index2
LTEXT Control
LTEXT text_TEXT, id_ID, x_X, y_Y, width_WIDTH, heightLA.P0Q [, style_STYLE [, extended-styleC6RBWW]]
The LTEXT statement creates a left-aligned text control. The control is a simple rectangle displaying the given text left-aligned in the rectangle. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line. The LTEXT statement, which can be used only in a DIALOG statement, defines the text, identifier, dimensions, and attributes of the control.
Parameters
style
Specifies the control styles. This value can be any combination of the BS_RADIOBUTTON156T_1O@api32wh.hlp style and the follow ing styles: SS_LEFT17_C1RU@api32wh.hlp, WS_TABSTOP19PJ04J@api32wh.hlp, and WS_GROUP5Q7E73@api32wh.hlp.
If you do not specify a style, the default style is SS_LEFT and WS_GROUP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "Common Statement ParametersXZYYJY".
Example
This example creates a left-aligned text control that is labeled "Filename":
LTEXT "Filename", 101, 10, 10, 100, 100

See Also
CONTROL2HOARS5, DIALOGHE4UAD, CTEXT_CTEXT, RTEXT_RTEXT
+$#K{bmc bm0.BMP}%67UJIQ>index2
MENU Resource
menuID MENU [load-memG1NESG][optional-statements]BEGIN item-definitions . . .END
The MENU statement defines the contents of a menu resource. A menu resource is a collection of information that defines the appearance and function of an application menu. A menu is a special input tool that lets a user select commands from a list of command names.
Parameters
menuID
Identifies the menu. This value is either a unique string or a unique 16-bit unsigned integer value in the range of 1 to 65,535.
l oad-mem
Specifies loading and memory attributes for the resource. For more information, see "Common Resource AttributesG1NESG".
optional-statements
Zero or more of the following statements:
Statement Decription
CHARACTERISTICS dwordAFGW2L User-defined information about a resource that can be used by tools that read and write resource files.
LANGUAGE language, s u blanguageKMK1GX Specifies the language for the resource. The parameters are constants from WINNLS.H.
VERSION dword.5OWYK Use r-defined v ersion number for the resource that can be used by tools that read and write resource files.

Example
Followin g is an example of a complete MENU statement:
sample MENUBEGIN MENUITEM "&Soup", 100 MENUITEM "S&alad", 101 POPUP "&Entree" BEGIN MENUITEM "&Fish", 200 MENUITEM "&Chicken", 201, CHECKED POPUP "&Beef" BEGIN MENUITEM "&Steak", 301 MENUITEM "&Prime Rib", 302 END END MENUITEM "&Dessert", 103END

See Also
MENUITEM3VT9D3, POPUP_POPUPMultiline Statements1VYW4OOCHARACTERISTICSAFGW2L, LANGUAGEKMK1GX, VERSION.5OWYKACCELERATORS7GJLS6, DIALOGHE4UAD, MENU_MENU, RCDATA95VJYY, STRINGTABLE1UH1OD0
+$#K{bmc bm0.BMP}%67UJIQ>index2
MENU Statement
MENU menuname
The MENU statement defines the dialog box's menu. If no statement is given, the dialog box has no menu.
Parameter
menuname
Specifies the menu to use. This value is either the name of the menu or the integer identifier of the menu.

Example
The following example demonstr ates the use of the MENU dialog statement:
MENU errmenu

+$#K{bmc bm0.BMP}%67UJIQ>index2
MENUEX Resource
The MENUEX resource is an extension of the MENU_MENU resource. In addition to the functionality offered by MENU, MENUEX allows for the following:
· Help IDs on popup menus.
· IDs on popup menus.
· Use of the menu type and state flags created for Windows 95 (MFT_* type flags and MFS_* state flags).

Syntax
menuID MENUEXBEGIN [{[MENUITEM itemText [, [id] [, [type] [, state]]]] | [POPUP itemText [, [id] [, [type] [, [state] [, helpID]]]] BEGIN popupBody END]} ...]END
Parameters
MENUITEM statement
Defines a normal menu item
itemText
Specifies the string containing the text for the menu item. For more information, see MENUITEM3VT9D3.
id
Specifies a numeric expression indicating the ID of the menu item.
type
Specifies a numeric expression indicating the type of the menu item (explicit MFT_* type values defined in WINUSER.H can be used by adding an include to the RC file: #include "WINUSER.H")
state
Specifies a numeric expression indicating the state of the menu item (explicit MFS_* state values defined in WINUSER.H can be used by adding an include to the RC file: #include "WINUSER.H")

POPUP statement
Defines a menu item which has another menu (a submenu) associated with it.
itemText
Specifies a string containing the text for the menu item.
id
Specifies a numeric expression indicating the ID of the menu item.
type
Specifies a numeric expression indicating the type of the menu item (explicit MFT_* type values defined in WINUSER.H can be used by adding an include to the RC file: #include "WINUSER.H").
state
Specifies a numeric expression indicating the state of the menu item (explicit MFS_* state values defined in WINUSER.H can be used by adding an include to the RC file: #include "WINUSER.H").
helpID
Specifies a numeric expression indicating the ID used to identify the menu during WM_HELP processing.

popupBody
Contain any combination of the MENUITEM3VT9D3 and POPUP_POPUP statements described above.

Remarks
Valid arithmetic and Boolean operations that may be contained in any of the numeric expressions in the statements of MENUEX are:
· Add ('+')
· Subtract ('-')
· Unary minus ('-')
· Unary NOT ('~')
· AND ('&')
· OR ('|')
See Also
MENU_MENU, MENUITEM3VT9D3, POPUP_POPUPMultiline Statements1VYW4OOACCELERATORS7GJLS6, CHARACTERISTICSAFGW2L, DIALOGHE4UAD, LANGUAGEKMK1GX, RCDATA95VJYY, STRINGTABLE1UH1OD0,VERSION.5OWYK
+$#K{bmc bm0.BMP}%67UJIQ>index2
MENUITEM Statement
MENUITEM text_TEXT, result, [optionlist]MENUITEM SEPARATOR
The MENUITEM statement defines a menu item.
Parameters
text
Specifies the name of the menu item.
The string can contain the escape characters \t and \a. The \t character inserts a tab in the string and is used to align text in columns. Tab characters should be used only in pop-up menus, not in menu bars. (For information on pop-up menus, see the POPUP statement.) The \a character aligns all text that follows it flush right to the menu bar or pop-up menu.
result
Specifies the result generated when the user selects the menu item. This parameter takes an integer value. Menu-item results are always integers; when the user clicks the menu-item name, the result is sent to the window that owns the menu.
optionlist
Specifies the appearance of the menu item. This optional parameter takes one or more redefined menu options, separated by commas or spaces. The menu options are as follows:
CHECKED
Item has a check mark next to it.
GRAYED
Item name is initially inactive and appears on the menu in gray or a lightened shade of the menu-text color.
HELP
Identifies a help item.
INACTIVE
Item name is displayed but it cannot be selected.
MENUBARBREAK
Same as MF_MENUBREAK except that for pop-up menus, it separates the new column from the old column with a vertical line.
MENUBREAK
Places the menu item on a new line for static menu-bar items. For pop-up menus, it places the menu item in a new column with no dividing line between the columns.
The INACTIVE and GRAYED options cannot be used together.

SEPARATOR
The MENUITEM SEPARATOR form of the MENUITEM statement creates an inactive menu item that serves as a dividing bar between two active menu items in a pop-up menu.

Example
The following example demonstrates the use of the MENUITEM and MENUITEM SEPARATOR statements:
MENUITEM "&Roman", 206, CHECKED, GRAYEDMENUITEM SEPARATORMENUITEM "&Blackletter", 301

See Also
MENU_MENU, POPUP_POPUP
+$#K{bmc bm0.BMP}%67UJIQ>index2
MESSAGETABLE Resource
nameID MESSAGETABLE filename
The MESSAGETABLE resource-deinition statement defines the ID and file of an application's message table resource. Message tables are special string resources used in event logging17ICFMK@api32wh.hlp and with the FormatMessage3MR4VG9@api32wh.hlp API. The file contains a binary message table generated by the Message CompilerJO9K.@mc.hlp. The Message Compiler also generates a resource script file that contains the MESSAGETABLE statements you need to include the message table resources in the compiled resource file. Use the #include directive to include this resource script into your main resource script.
Parameters
nameID
Specifies either a unique name or a 16-bit unsigned integer value identifying the resource.
filename
Specifies the name of the file that contains the resource. The name must be a valid filename; it must be a full path if the file is not in the current working directory. The path can either be a quoted or non-quoted string.
See Also
STRINGTABLE Resource1UH1OD0, Message CompilerJO9K.@mc.hlp
+$#K{bmc bm0.BMP}%67UJIQ>index2
POPUP Resource
POPUP text_TEXT, [optionlist]
BEGIN item-definitions . . .END
The POPUP statement marks the beginning of the definition of a pop-up menu. A pop-up menu (which is also known as a drop-down menu) is a special menu item that displays a sublist of menu items when it is selected.
Parameters
text
Specifies the name of the pop-up menu. This string must be enclosed in double quotation marks.
optionlist
Specifies one or more redefined menu options that specify the appe arance of the menu item. The menu options follow:
CHECKED
Item has a check mark next to it. This option is not valid for a top-level pop-up menu.
GRAYED
Item name is initially inactive and appears on the menu in gray or a lightened shade of the menu-text color.
INACTIVE
Item name is displayed but it cannot be selected.
MENUBARBREAK
Same as MF_MENUBREAK except that for pop-up menus, it separates the new column from the old column with a vertical line.
MENUBREAK
Places the menu item on a new line for static menu-bar items. For pop-up menus, it places the menu item in a new column with no dividing line between the columns.
The INACTIVE and GRAYED options cannot be used together.

Example
The following example demonstrates the use of the POPUP statement:
chem MENUBEGIN POPUP "&Elements" BEGIN MENUITEM "&Oxygen", 200 MENUITEM "&Carbon", 201, CHECKED MENUITEM "&Hydrogen", 202 MENUITEM SEPARATOR MENUITEM "&Sulfur", 203 MENUITEM "Ch&lorine", 204 END POPUP "&Compounds" BEGIN POPUP "&Sugars" BEGIN MENUITEM "&Glucose", 301 MENUITEM "&Sucrose", 302, CHECKED MENUITEM "&Lactose", 303, MENUBREAK MENUITEM "&Fructose", 304 END POPUP "&Acids" BEGIN "&Hydrochloric", 401 "&Sulfuric", 402 END ENDEND

See Also
MENU_MENU, MENUITEM3VT9D3
+$#K{bmc bm0.BMP}%67UJIQ>index2
PUSHBOX Control
PUSHBOX text_TEXT, id_ID, x_X, y_Y, width_WIDTH, heightLA.P0Q [, style_STYLE [, extended-styleC6RBWW]]
The PUSHBOX statement creates a push-box control. Identical to a PUSHBUTTON, except that it does not display a button face or frame; only the text appears.
Parameters
style
Specifies styles for the pushbox, which can be a combination of the BS_PUSHBOX style and the following styles: WS_TABSTOP, WS_DISABLED, and WS_GROUP.
The default style is BS_PUSHBOX and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "Common Statement ParametersXZYYJY".
See Also
PUSHBUTTONJW7TB5
+$#K{bmc bm0.BMP}%67UJIQ>index2
PUSHBUTTON Control
PUSHBUTTON text_TEXT, id_ID, x_X, y_Y, width_WIDTH, heightLA.P0Q [, style_STYLE [, extended-styleC6RBWW]]
The PUSHBUTTON statement creates a push-button control. The control is a round-cornered rectangle containing the given text. The text is centered in the control. The control sends a message to its parent whenever the user chooses the control.
Parameters
style
Specifies styles for the pushbutton, which can be a combination of the BS_PUSHBUTTON style and the following styles: WS_TABSTOP, WS_DISABLED, and WS_GROUP.
The default style is BS_PUSHBUTTON and WS_T ABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "Common Statement ParametersXZYYJY".
Example
The following example demonstrates the use of the PUSHBUTTON statement:
PUSHBUTTON "ON", 7, 10, 10, 20, 10

See Also
GetDialogBaseUnits1.NE19N@api32wh.hlp
+$#K{bmc bm0.BMP}%67UJIQ>index2
RADIOBUTTON Control
RADIOBUTTON text_TEXT, id_ID, x_X, y_Y, width_WIDTH, heightLA.P0Q [, style_STYLE [, extended-styleC6RBWW]]
The RADIOBUTTON statement creates a radio-button control. The control is a small circle that has the given text displayed next to it, typically to its right. The control highlights the circle and sends a message to its parent window when the user selects the button. The control removes the highlight and sends a message when the button is next selected.
Parameters
style
Specifies styles for the radio button, which can be a combination of BUTTON-class styles and the following styles: WS_TABSTOP, WS_DISABLED, and WS_GROUP.
The default style for RADIOBUTTON is BS_RADIOB UTTON and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "Common Statement ParametersXZYYJY".
Example
The following example demonstrates the use of the RADIOBUTTON statement:
RADIOBUTTON "Italic", 100, 10, 10, 40, 10
See Also
GetDialogBaseUnits1.NE19N@api32wh.hlp
+$#K{bmc bm0.BMP}%67UJIQ>index2
RCDATA Resource
nameID RCDATA [load-memG1NESG][optional-statements]BEGIN raw-data . . .END
The RCDATA statement defines a raw data resource for an application. Raw data resources permit the inclusion of binary data directly in the executable file.
Parameters
nameID
Specifies either a unique name or a 16-bit unsigned integer value that identifies the resource.
load-mem
Specifies loading and memory attributes for the resource. For more information, see "Common Resource AttributesG1NESG".
optional-statements
Zero or more of the following statements:
Statement Decription
CHARACTERISTICS dwordAFGW2L User-defined information about a resource that can be used by tools that read and write resource files.
LANGUAGE language, sublanguageKMK1GX Specifies the language for the resource. The parameters are constants from WINNLS.H.
VERSION dword.5OWYK User-defined version number for the resource that can be used by tools that rea d and wri te resource files.

raw-data
Specifies raw data consisting of one or more integers or strings of characters. Int e gers can be specified in decimal, octal, or hexadecimal format. RC does not automatically append a terminating null character to a string. The string is a sequence of the specified ANSI (byte) characters unless explicitly qualified as a wide-character string with the L prefix. Strings in all resources other than RCDATA and user-defined resources are Unicode strings.
The block of data begins on a DWORD boundary and RC performs no padding or alignment of data within the raw-data block. It is the programmer's responsibility to ensure the proper alignment of data within the block.

Example
The following example demonstrates the use of the RCDATA statement:
resname RCDATABEGIN L"Here is a Unicode string\0", /* A Unicode string. Note: explicitly null-terminated */ 1024, /* int */ 0x029a, /* hex int */ 0o733, /* octal int */ "\07" /* octal byte */END

See Also
Multiline Statements1VYW4OOCHARACTERISTICSAFGW2L, LANGUAGEKMK1GX, VERSION.5OWYKACCELERATORS7GJLS6, DIALOGHE4UAD, MENU_MENU, RCDATA95VJYY, STRINGTABLE1UH1OD0
+$#K{bmc bm0.BMP}%67UJIQ>index2
RTEXT Control
RTEXT text_TEXT, i d_ID, x_X, y_Y, width_WIDTH, heightLA.P0Q [, style_STYLE [, extended-styleC6RBWW]]
The RTEXT statement creates a right-aligned text control. The control is a simple rectangle displaying the given text right-aligned in the rectangle. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line.
Parameters
style
Specifies styles for the text control, which can be any combination of the following: WS_TABSTOP and WS_GROUP.
The default style for RTEXT is SS_RIGHT and WS_GROUP.

For more information on the text, id, x, y, width, h eight, style, and extended-style parameters, see "Common Statement ParametersXZYYJY".
Example
The following example demonstrates the use of the RTEXT statement:
RTEXT "Number of Messages", 4, 30, 50, 100, 10

See Also
CONTROL2HOARS5, CTEXT_CTEXT, DIALOGHE4UAD, LTEXT_LTEXT
+$#K{bmc bm0.BMP}%67UJIQ>index2
SCROLLBAR Control
SCROLLBAR text_TEXT, id_ID, x_X, y_Y, width_WIDTH, heightLA.P0Q [, style_STYLE [, extended-styleC6RBWW]]
The SCROLLBAR statement creates a scroll-bar control. The control is a rectangle that contains a scroll box and has direction arrows at both ends. The scroll-bar control sends a notification message to its parent whenever the user clicks the mouse in the control. The parent is responsible for updating the scroll-box position. Scroll-bar controls can be positioned anywhere in a window and used whenever needed to provide scrolling input.
Parameters
style
Specifies a combination (or none) of the following styles: WS_TABSTOP, WS_GROUP, and WS_DISABLED.
In addition to these styles, the style parameter may contain a combination (or none) of the SCROLLBAR-class styles. The d efault style for SCROLLBAR is SBS_HORZ.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "Common Statement ParametersXZYYJY".
Example
The following example demonstrates the use of the SCROLLBAR statement:
SCROLLBAR 999, 25, 30, 10, 100

+$#K{bmc bm0.BMP}%67UJIQ>index2
STATE3 Control
STATE3 text_TEXT, id_ID, x_X, y_Y, width_WIDTH, heightLA.P0Q [, style_STYLE [, extended-styleC6RBWW]]
The STATE3 statement defines a 3-state check box control. The control is identical to a CHECKBOX, except that it has three states: checked, unchecked, and disabled (grayed).
Parameters
text
Specifies text that is displayed to the right of the control.
style
Specifies the control styles. This value can be a combination of the button class style BS_3STATE and the WS_TABSTOP and WS_GROUP styles.
If you do not s pecify a style, the default style is BS_3STATE and WS_TABSTOP.

For more information on the text, id, x, y, width, height, style, and extended-style parameters, see "Common Statement ParametersXZYYJY".
See Also
AUTOCHECKBOXFAUEF2, CHECKBOXWBG55P, CONTROL2HOARS5
+$#K{bmc bm0.BMP}%67UJIQ>index2
STRINGTABLE Resource
STRINGTABLE [load-memG1NESG][optional-statements]BEGIN stringID string . . .END
The STRINGTABLE statement defines one or more string resources for an application. String resources are simply null-terminated Unicode strings that can be loaded when needed from the executable file, using the LoadStringLIEJN7@api32wh.hlp function.
Parameter
load-mem
Specifies loading and memory attributes for the resource. For more information, see "Common Resource AttributesG1NESG".
optional-statements
Zero or more of the following statements:
Statement Decription
CHARACTERISTICS dwo rdAFGW2L User-defined information about a resource that can be used by tools that read and write resource files.
LANGUAGE language, sublanguageKMK1GX Specifies the language for the resource. The parameters are constants from WIN N LS.H.
VERSION dword.5OWYK User-defined version number for the resource that can be used by tools that read and write resourc e files.

stringID
Specifies an unsigned 16-bit integer that identifies the resource.
string
Specifies one or more string s, enclosed in double quotation marks. The string must be no longer than 255 characters and must occupy a single line in the source file. To add a carriage return to the string, use this character sequence: \012. For example, "Line one\012Line two" would define a string that would be displayed as follows:
Line oneLine two

Comments
Grouping strings in separate sections allows all related strings to be read in at one time and discarded together. When possible, an application should make the table movable and discardable. RC allocates 16 strings per section and uses the identifier value to determine which section is to contain the string. Strings with the same upper-12 bits in their identifiers are placed in the same section.
Example
The following example demonstrates the use of the STRINGTABLE statement:
#define IDS_HELLO 1#define IDS_GOODBYE 2STRINGTABLEBEGIN IDS_HELLO, "Hello" IDS_GOODBYE, "Goodbye"END

See Also
Multiline Statements1VYW4OOCHARACTERISTICSAFGW2L, LANGUAGEKMK1GX, VERSION.5OWYKACCELERATORS7GJLS6, DIALOGHE4UAD, MENU_MENU, RCDATA95VJYY, STRINGTABLE1UH1OD0
+$#K{bmc bm0.BMP}%67UJIQ>index2
STYLE Statement
STYLE style
The STYLE statement def ines the window style of the dialog box. The window style specifies whether the box is a pop-up or a child window. The default style has the following attributes: WS_POPUP5Z4F73@api32wh.hlp, WS_BORDERVIIT18@api32wh.hlp, and WS_SYSMENUR6CV3O@api32wh.hlp.
Parameter
style
Specifies the window style. This parameter takes an integer value or redefined name. The following lists the redefined styles:
DS_LOCALEDIT
Specifies that edit controls in the dialog box will use memory in the application's data section. By default, all edit controls in dialog boxes use memory outside the application's data section. This feature can be suppressed by adding the DS_LOCALEDIT flag to the STYLE command for the dialog box. If this flag is not used, EM_GETHANDLE and EM_SETHANDLE messages must not be used since the storage for the control is not in the application's data section. This feature does not affect edit controls created outside of dialog boxes.
DS_MODALFRAME
Creates a dialog box with a modal dialog box frame that can be combined with a title bar and System menu by specifying the WS_CAPTION and WS_SYSMENU styles.
DS_NOIDLEMSG
Suppresses WM_ENTERIDLE messages that Windows would otherwise send to the owner of the dialog box while the dialog box is displayed.
DS_SYSMODAL
Creates a system-modal dialog box.
WS_BORDER
Creates a window that has a border.
WS_CAPTION
Creates a window that has a title bar (implies the WS_BORDER style).
WS_CHILD
Creates a child window. It cannot be used with the WS_POPUP style.
WS_CHILDWINDOW
Creates a child window that has the WS_CHILD style.
WS_CLIPCHILDREN
Excludes the area occupied by child windows when drawing within the parent window. Used when creating the parent window.
WS_CLIPSIBLINGS
Clips child windows relative to each other; that is, when a particular child window receives a WM_PAINT message, this style clips all other top-level child windows out of the region of the child window to be updated. (If the WS_CLIPSIBLINGS style is not given and child windows overlap, it is possible, when drawing in the client area of a child window, to draw in the client area of a neighboring child window.) For use with the WS_CHILD style only.
WS_DISABLED
Creates a window that is initially disabled.
WS_DLGFRAME
Creates a window with a modal dialog box frame but no title.
WS_GROUP
Specifies the first control of a group of controls in which the user can move from one control to the next by using the arrow keys. All controls defined with the WS_GROUP style after the first control belong to the same group. The next control with the WS_GROUP style ends the style group and starts the next group (that is, one group ends where the next begins). This style is valid only for controls.
WS_HSCROLL
Creates a window that has a horizontal scroll bar.
WS_ICONIC
Creates a window that is initially iconic. For use with the WS_OVERLAPPED style only.
WS_MAXIMIZE
Creates a window of maximum size.
WS_MAXIMIZEBOX
Creates a window that has a Maximize box.
WS_MINIMIZE
Creates a window of minimum size.
WS_MINIMIZEBOX
Creates a window that has a Minimize box.
WS_OVERLAPPED
Creates an overlapped window. An overlapped window has a caption and a border.
WS_OVERLAPPEDWINDOW
Creates an overlapped window having the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles.
WS_POPUP
Creates a pop-up window. It cannot be used with the WS_CHILD style.
WS_POPUPWINDOW
Creates a pop-up window that has the WS_POPUP, WS_BORDER, and WS_SYSMENU styles. The WS_CAPTION style must be combined with the WS_POPUPWINDOW style to make the System menu visible.
WS_SIZEBOX
Creates a window that has a size box. Used only for windows with a title bar or with vertical and horizontal scroll bars.
WS_SYSMENU
Creates a window that has a System-menu box in its title bar. Used only for windows with title bars. If used with a child window, this style creates a Close box instead of a System-menu box.
WS_TABSTOP
Specifies one of any number of controls through which the user can move by using the TAB key. The TAB key moves the user to the next control specified by the WS_TABSTOP style. This style is valid only for controls.
WS_THICKFRAME
Creates a window with a thick frame that can be used to size the window.
WS_VISIBLE
Creates a window that is initially visible. This applies to overlapping and pop-up windows. For overlapping windows, the y parameter is used as a parameter for the ShowWindow6NSBKQ@api32wh.hlp function.
WS_VSCROLL
Creates a window that has a vertical scroll bar.

Comments
If the redefined names are used, you must include WINDOWS.H.
+$#K{bmc bm0.BMP}%67UJIQ>index2
User-Defined Resource
nameID typeID [load-memG1NESG] filename
The filename specifies the name of a file containing the binary data of the resource. The contents of the file are included as the resource. RC does not interpret the binary data in any way. It is the programmer's responsibility to ensure that the data is properly aligned for the target machine architecture.
A user-defined resource can also be defined completely in the resource script using the syntax:
nameID typeID [load-memG1NESG]BEGIN raw-dataEND
A user-defined resource statement specifies a resource that contains application-specific data. The data can have any format and can be defined either as the content of a given file (if the filename parameter is given) or as a series of number s and strings (if the raw-data block is given).
Parameters
nameID
Specifies either a unique name or a 16-bit unsigned integer that identifies the resource.
typeID
Specifies either a unique name or a 16-bit unsigned integer that identifies the resource type. If a number is given, it must be greater than 25 5. The numbers 1 through 255 are reserved for existing and future redefined resource types.
load-mem
Specifies loading and memory attributes for the resource. For more information, see "Common Resource AttributesG1NESG".
filename
Specifies the name of the file that contains the resource data. The parameter must be a valid filename; it must be a full path if the file is not in the current working directory.
raw-data
Specifies raw data consisting of one or more integers or strings of characters. Integers can be specified in decimal, octal, or hexadecimal format. RC does not automatically append a terminating null character to a string. The string is a sequence of the specified ANSI (byte) characters unless explicitly qualified as a wide-character string with the L prefix. Strings in all resources other than RCDATA and user-defined resources are Unicode strings.
The block of data begins on a DWORD boundary and RC performs no padding or alignment of data within the raw-data block. It is the programmer's responsibility to ensure the proper alignment of data within the block.

Example
The following example shows several user-defined statements:
array MYRES data.res14 300 custom.res18 MYRES2BEGIN "Here is a data string\0", /* A string. Note: explicitly null-terminated */ 1024, /* int */ 0x029a, /* hex int */ 0o733, /* octal int */ "\07" /* octal byte */END

+$#K{bmc bm0.BMP}%67UJIQ>index2
VERSION Statement
VERSION dword
The VERSION statement allows the developer to specify version information about a resource that can be used by tools that read and write resource files. The specified dword value appears with the resource in the compiled .RES file. However, the value is not stored in the executable file and has no significance to Windows.
The VERSION statement appears before the BEGIN in an ACCELERATORS, DIALOG, MENU, RCDATA, or STRINGTABLE resource definition. The specified value applies only to that resource.
Parameter
dword
A user-defined doubleword value.

See Also
Multiline Statements1VYW4OOCHARACTERISTICSAFGW2L, LANGUAGEKMK1GX, VERSION.5OWYKACCELERATORS7GJLS6, DIALOGHE4UAD, MENU_MENU, RCDATA95VJYY, STRINGTABLE1UH1OD0
+$#K{bmc bm0.BMP}%67UJIQ>index2
VERSIONINFO Resource
versionID VERSIONINFO fixed-infoBEGIN block-s tatement . . .END
The VERSIONINFO statement creates a version-information resource. The resource contains such information about the file as its version number, its intended operating system, and its original filename. The resource is intended to be used with the File Installation library functions.
Parameters
versionID
Specifies the version-information resource identifier. This value must be 1.
fixed-info
Specifies the version information, such as the file version and the intended operating system. This parameter consists of the following statements:
FILEVERSION version
Specifies the binary version number for the file. The version consists of two 32-bit integers, defined by four 16-bit integers. For example, FILEVERSION 3,10,0,61 is translated into two doublewords: 0x0003000a and 0x0000003d, in that order. Therefore, if ver sion is defined by the doublewords dw1 and dw2, they need to appear in the FILEVERSION statement as follows: HIWORD(dw1), LOWORD(dw1), HIWORD(dw2), LOWORD(dw2).
PRODUCTVERSION version
Specifies the binary version number for the product with which the file is distributed. The version parameter is two 32-bit integers, defined by four 16-bit integers. For more information about version, see the FILEVERSION description.
FILEFLAGSMASK fileflag smask
Specifies which bits in the FILEFLAGS statement are valid. If a bit is set, the corresponding bit in FILEFLAGS is valid.
FILEFLAGS fileflags
Specifies the Boolean attributes of the file. The fileflags parameter must be the combination of all the file f lags that are valid at compile time. For Windows 3.1, this value is 0x3f.
FILEOS fileos
Specifies the operating system for which this file was de signed. The fileos parameter can be one of the operating system values given in the Comments section.
FILETYPE filetype
Specifies the general type of file. The filetype parameter can be one of the file type values listed in the Comments section.
FILESUBTYPE subtype
Specifies the function of the file. The subtype parameter is zero unless the type parameter in the FILETYPE sta tement is VFT_DRV, VFT_FONT, or VFT_VXD. For a list of file subtype values, see the Comments section.
block-statement
Specifies one or more version-information blocks. A block can contain string information or variable information.

Comments
To use the constants specified with the VERSIONINFO statement, the WINVER.H file (included in WINDOWS.H) must be included in the resource-definition file.
The following list describes the parameters used in the VERSIONINFO statement:
Parameter
fileflags
Specifies a combination of the following values:
VS_FF_DEBUG
File contains debugging information or is compiled with debugging features enabled.
VS_FF_INFOINFERRED
File contains a dynamically created version-information resource. Some of the blocks for th e resource may be empty or incorrect. This value is not intended to be used in version-information resources created by using the VERSIONINFO statement.
VS_FF_PATCHED
File has been modified and is not identical to the original shipping file of the same version number.
VS_FF_PRERELEASE
File is a development version, not a commercially released product.
VS_FF_PRIVATEBUILD
File was not built using standard release procedures. If this value is given, the StringFileInfo block must contain a PrivateBuild string.
VS_FF_SPECIALBUILD
File was built by the original company using standard release procedures but is a variation of the standard file of the same version number. If this value is given, the StringFileInfo block must contain a SpecialBuild string.
fileos
Specifies one of the following values:
Value Description
VOS_UNKNOWN Operating system for which the file was designed is unknown to Windows.
VOS_DOS File was designed for MS-DOS.
VOS_NT File was designed for Windows NT.
VOS_WINDOWS16 File was designed for Windows version 3.0 or later.
VOS_WINDOWS32 File was designed for 32-bit Windows.
VOS_DOS_WINDOWS16 File was designed for Windows version 3.0 or later running with MS-DOS.
VOS_DOS_WINDOWS32 File was designed for 32-bit Windows running with MS-DOS.
VOS_NT_WINDOWS32 File was designed for 32-bit Windows running with Windows NT.

The values 0x00002L, 0x00003L, 0x20000L and 0x30000L are reserved.
filetype
Specifies one of the following values:
Value Description
VFT_UNKNOWN File type is unknown to Windows.
VFT_APP File contains an application.
VFT_DLL File contains a dynamic-link library (DLL).
VFT_DRV File contains a device driver. If the dwFileType member is VFT_DRV, the dwFileSubtype member contains a more specific description of the driver.
VFT_FONT File contains a font. If the dwFileType member is VFT_FONT, the dwFileSubtype member contains a more specific description of the font.
VFT_VXD File contains a virtual device.
VFT_STATIC_LIB File contains a static-link library.

All other values are reserved for use by Microsoft.
subtype
Specifies additional information about the file type.
If the FILETYPE statement specifies VFT_DRV, this parameter can be one of the following values:
Value Description
VFT2_UNKNOWN Driver type is unknown to Windows.
VFT2_DRV_COMM File contains a communications driver.
VFT2_DRV_PRINTER File contains a printer driver.
VFT2_DRV_KEYBOARD File contains a keyboard driver.
VFT2_DRV_LANGUAGE File contains a language driver.
VFT2_DRV_DISPLAY File contains a display driver.
VFT2_DRV_MOUSE File contains a mouse driver.
VFT2_DRV_NETWORK File contains a network driver.
VFT2_DRV_SYSTEM File contains a system driver.
VFT2_DRV_INSTALLABLE File contains an installable driver.
VFT2_DRV_SOUND File contains a sound driver.

If the FILETYPE statement specifies VFT_FONT, this parameter can be one of the following values:
Value Description
VFT2_UNKNOWN Font type is unknown to Windows.
VFT2_FONT_RASTER File contains a raster font.
VFT2_FONT_VECTOR File contains a vector font.
VFT2_FONT_TRUETYPE File contains a TrueType font.

If the FILETYPE statement specifies VFT_VXD, this parameter must be the virtual-device identifier included in the virtual-device control block.
All subtype values not listed here are reserved for use by Microsoft.
langID
Specifies one of the following language codes:
Code Language Code Language
0x0401 Arabic 0x0417 Rhaeto-Romanic
0x0402 Bulgarian 0x0418 Romanian
0x0403 Catalan 0x0419 Russian
0x0404 Traditional Chinese 0x041A Croato-Serbian (Latin)
0x0405 Czech 0x041B Slovak
0x0406 Danish 0x041C Albanian
0x0407 German 0x041D Swedish
0x0408 Greek 0x041E Thai
0x0409 U.S. English 0x041F Turkish
0x040A Castilian Spanish 0x0420 Urdu
0x040B Finnish 0x0421 Bahasa
0x040C French 0x0804 Simplified Chinese
0x040D Hebrew 0x0807 Swiss German
0x040E Hungarian 0x0809 U.K. English
0x040F Icelandic 0x080A Mexican Spanish
0x0410 Italian 0x080C Belgian French
0x0411 Japanese 0x0810 Swiss Italian
0x0412 Korean 0x0813 Belgian Dutch
0x0413 Dutch 0x0814 Norwegian - Nynorsk
0x0414 Norwegian - Bokml 0x0816 Portuguese
0x0415 Polish 0x081A Serbo-Croatian (Cyrillic)
0x0416 Brazilian Portuguese 0x0C0C Canadian French
0x0417 Rhaeto-Romanic 0x100C Swiss French

charsetID
Specifies one of the following character-set identifiers:
Identifier Character Set
0 7-bit ASCII
932 Windows, Japan (Shift - JIS X-0208)
949 Windows, Korea (Shift - KSC 5601)
950 Windows, Taiwan (GB5)
1200 Unicode
1250 Windows, Latin-2 (Eastern European)
1251 Windows, Cyrillic
1252 Windows, Multilingual
1253 Windows, Greek
1254 Windows, Turkish
1255 Windows, Hebrew
1256 Windows, Arabic

string-name
Specifies one of the following redefined names:
Comments
Specifies additional information that should be displayed for diagnostic purposes.
CompanyName
Specifies the company that produced the file¾for example, "Microsoft Corporation" or "Standard Microsystems Corporation, Inc.". This string is required.
FileDescription
Specifies a file description to be presented to users. This string may be displayed in a list box when the user is choosing files to install¾for example, "Keyboard Driver for AT-Style Keyboards" or "Microsoft Word for Windows". This string is required.
FileVersion
Specifies the version number of the file¾for example, "3.10" or "5.00.RC2". This string is required.
InternalName
Specifies the internal name of the file, if one exists¾for example, a module name if the file is a dynamic-link library. If the file has no internal name, this string should be the original filename, without extension. This string is required.
LegalCopyright
Specifies all copyright notices that apply to the file. This should include the full text of all notices, legal symbols, copyright dates, and so on¾for example, "Copyright© Microsoft Corporation 1990-1992". This string is optional.
LegalTrademarks
Specifies all trademarks and registered trademarks that apply to the file. This should include the full text of all notices, legal symbols, trademark numbers, and so on¾for example, "Windows™ is a trademark of Microsoft® Corporation". This string is optional.
OriginalFilename
Specifies the original name of the file, not including a path. This information enables an application to determine whether a file has been renamed by a user. The format of the name depends on the file system for which the file was created. This string is required.
PrivateBuild
Specifies information about a private version of the file¾for example, "Built by TESTER1 on \TESTBED". This string should be present only if the VS_FF_PRIVATEBUILD flag is set in the dwFileFlags member of the VS_FIXEDFILEINFO structure of the root block.
ProductName
Specifies the name of the product with which the file is distributed¾for example, "Microsoft Windows". This string is required.
ProductVersion
Specifies the version of the product with which the file is distributed¾for example, "3.10" or "5.00.RC2". This string is required.
SpecialBuild
Specifies how this version of the file differs from the standard version¾for example, "Private build for TESTER1 solving mouse problems on M250 and M250E computers". This string should be present only if the VS_FF_SPECIALBUILD flag is set in the dwFileFlags member of the VS_FIXEDFILEINFO structure in the root block.

A string information block has the following form:
BLOCK "StringFileInfo"BEGIN BLOCK "lang-charset" BEGIN VALUE "string-name", "value" . . . ENDEND
Following are the parameters in the StringFileInfo block:
lang-charset
Specifies a language and character-set identifier pair. It is a hexadecimal string consisting of the concatenation of the language and character-set identifiers listed earlier in this section.
string-name
Specifies the name of a value in the block and can be one of the redefined names listed earlier in this section.
value
Specifies, as a character string, the value of the corresponding string name. More than one VALUE statement can be given.

A variable information block has the following form:
BLOCK "VarFileInfo"BEGIN VALUE "Translation", langID, charsetID . . .END
Following are the parameters in the variable information block:
langID
Specifies one of the language identifiers listed earlier in this section.
charsetID
Specifies one of the character-set identifiers listed earlier in this section. More than one identifier pair can be given, but each pair must be separated from the preceding pair with a comma.

+$#K{bmc bm0.BMP}%XVELT1>index2
Preprocessing Reference
The syntax and semantics for the RC preprocessor is the same as for the preprocessor in a C compiler. Single-line comments begin with two forward slashes (//) and run to the end of the line. Block comments begin with an opening delimiter (/*) and run to a closing delimiter (*/). Comments do not nest.
You use the #define directive to define symbols for your resource identifiers in a header file. You include this header both in the resource script and your application source code. Similarly, the values for attributes and styles are defined by including the C header files for Windows.
You can also define macros. The standard C preprocessing operators (#, ##) can be used in a macro definition. For detailed information on preprocessing and defining macros, see your C compiler documentation.

Directive Description
#define_define Defines a specified name by assigning it a given value.
#elif_elif Marks an optional clause of a conditional-compilation block.
#else_else Marks the last optional clause of a conditional-compilation block.
#endif_endif Marks the end of a conditional-compilation block.
#if_if Conditionally compiles the script if a specified expression is true.
#ifdef_ifdef Conditionally compiles the script if a specified name is defined.
#ifndef_ifndef Conditionally compiles the script if a specified name is not defined.
#include_include Copies the contents of a file into the resource-definition file.
#undef_undef Removes the definition of the specified name.

+$#K{bmc bm0.BMP}%XVELT1>index2{bmc bm1.BMP}%1MISHD_
#define
#define name value
The #define directive assigns the given value to the specified name. All subsequent occurrences of the name are replaced by the value.
Parameters
name
Specifies the name to be defined. This value is any combination of letters, digits, and punctuation.
value
Specifies any integer, character string, or line of text.

Example
This example assigns values to the names "NONZERO" and "USERCLASS":
#define NONZERO 1#define USERCLASS "MyControlClass"

See Also
#ifdef_ifdef, #ifndef_ifndef, #undef_undef
+$#K{bmc bm0.BMP}%XVELT1>index2{bmc bm1.BMP}%1MISHD_
#elif
#elif constant-expression
The #elif directive marks an optional clause of a conditional-compilation block defined by a #ifdef, #ifndef, or #if directive. The directive controls conditional compilation of the resource file by checking the specified constant expression. If the constant expression is nonzero, #elif directs the compiler to continue processing statements up to the next #endif, #else, or #elif directive and then skip to the statement after #endif. If the constant expression is zero, #elif directs the compiler to skip to the next #endif, #else, or #elif directive. You can use any number of #elif directives in a conditional block.
Parameter
constant-expression
Specifies the expression to be checked. This value is a defined name, an integer constant, or an expression consisting of names, integers, and arithmetic and relational operators.

Example
In this example, #elif directs the compiler to process the second BITMAP statement only if the value assigned to the name "Version" is less than 7. The #elif directive itself is processed only if Version is greater than or equal to 3.
#if Version < 3BITMAP 1 errbox.bmp#elif Version < 7BITMAP 1 userbox.bmp#endif

See Also
#else_else, #endif_endif, #if_if, #ifdef_ifdef, #ifndef_ifndef
+$#K{bmc bm0.BMP}%XVELT1>index2{bmc bm1.BMP}%1MISHD_
#else
#else
The #else directive marks an optional clause of a conditional-compilation block defined by a #ifdef, #ifndef, or #if directive. The #else directive must be the last directive before the #endif directive.
This directive has no arguments.
Example
This example compiles the second BITMAP statement only if the name "DEBUG" is not defined:
#ifdef DEBUG BITMAP 1 errbox.bmp#else BITMAP 1 userbox.bmp#endif

See Also
#elif_elif, #endif_endif, #if_if, #ifdef_ifdef, #ifndef_ifndef
+$#K{bmc bm0.BMP}%XVELT1>index2{bmc bm1.BMP}%1MISHD_
#endif
#endif
The #endif directive marks the end of a conditional-compilation block defined by a #ifdef directive. One #endif is required for each #if, #ifdef, or #ifndef directive.
This directive has no arguments.
See Also
#elif_elif, #else_else, #if_if, #ifdef_ifdef, #ifndef_ifndef
+$#K{bmc bm0.BMP}%XVELT1>index2{bmc bm1.BMP}%1MISHD_
#if
#if constant-expression
The #if directive controls conditional compilation of the resource file by checking the specified constant expression. If the constant expression is nonzero, #if directs the compiler to continue processing statements up to the next #endif, #else, or #elif directive and then skip to the statement after the #endif directive. If the constant expression is zero, #if directs the compiler to skip to the next #endif, #else, or #elif directive.
Parameter
constant-expression
Specifies the expression to be checked. This value is a defined name, an integer constant, or an expression consisting of names, integers, and arithmetic and relational operators.

Example
This example compiles the BITMAP statement only if the value assigned to the name "Version" is less than 3:
#if Version < 3BITMAP 1 errbox.bmp#endif

See Also
#elif_elif, #else_else, #endif_endif, #ifdef_ifdef, #ifndef_ifndef
+$#K{bmc bm0.BMP}%XVELT1>index2{bmc bm1.BMP}%1MISHD_
#ifdef
#ifdef name
The #ifdef directive controls conditional compilation of the resource file by checking the specified name. If the name has been defined by using a #define directive or by using the -d command-line option with the Resource Compiler, #ifdef directs the compiler to continue with the statement immediately after the #ifdef directive. If the name has not been defined, #ifdef directs the compiler to skip all statements up to the next #endif directive.
Parameter
name
Specifies the name to be checked by the directive.

Example
This example compiles the BITMAP statement only if the name "Debug" is defined:
#ifdef DebugBITMAP 1 errbox.bmp#endif

See Also
#define_define, #endif_endif, #if_if, #ifndef_ifndef, #undef_undef
+$#K{bmc bm0.BMP}%XVELT1>index2{bmc bm1.BMP}%1MISHD_
#ifndef
#ifndef name
The #ifndef directive controls conditional compilation of the resource file by checking the specified name. If the name has not been defined or if its definition has been removed by using the #undef directive, #ifndef directs the compiler to continue processing statements up to the next #endif, #else, or #elif directive and then skip to the statement after the #endif directive. If the name is defined, #ifndef directs the compiler to skip to the next #endif, #else, or #elif directive.
Parameter
name
Specifies the name to be checked by the directive.

Example
This example compiles the BITMAP statement only if the name "Optimize" is not defined:
#ifndef OptimizeBITMAP 1 errbox.bmp#endif

See Also
#elif_elif, #else_else, #endif_endif, #if_if, #ifdef_ifdef, #undef_undef
+$#K{bmc bm0.BMP}%XVE LT1>index2{bmc bm1.BMP}%1MISHD_
#include
#include (filename)
The #include directive causes Resource Compiler to process the file specified in the filename parameter. This file should be a header file that defines the constants used in the resource-definition file.
Parameter
filename
Specifies the name of the file to be included. If the file is in the current directory, the string must be enclosed in double quotation marks; if the file is in the directory specified by the INCLUDE environment variable, the string must be enclosed in less-than and greater-than characters (<>). You must give a full path enclosed in double quotation marks if the file is not in the current directory or in the directory specified by the INCLUDE environment variable.

Example
This example processes the header files WINDOWS.H and HEADERS\MYDEFS.H while compiling the resource-definition file:
#include <windows.h>#include "headers\mydefs.h"

See Also
#define_define
+$#K{bmc bm0.BMP}%XVELT1>index2{bmc bm1.BMP}%1MISHD_
#undef
#undef name
The #undef directive removes the current definition of the specified name. All subsequent occurrences of the name are processed without replacement.
Parameter
name
Specifies the name to be removed. This value is any combination of letters, digits, and punctuation.

Example
This example removes the definitions for the names "nonzero" and "USERCLASS":
#undef nonzero#undef USERCLASS

See Also
#define_define
+$#K{bmc bm0.BMP}%XVELT1>index2
RC Diagnostic Messages
{bmc bm2.BMP}%_ERR_A{bmc bm3.BMP}%_ERR_B{bmc bm4.BMP}%_ERR_C{bmc bm5.BMP}%_ERR_E{bmc bm6.BMP}%_ERR_F{bmc bm7.BMP}%_ERR_I{bmc bm8.BMP}%_ERR_N{bmc bm9.BMP}%_ERR_O{bmc bm10.BMP}%_ERR_R{bmc bm11.BMP}%_ERR_T{bmc bm12.BMP}%_ERR_U{bmc bm13.BMP}%_ERR_V{bmc bm14.B MP}%_ERR_W
The Help topics available under the alphabetic buttons at the top of the Help window contain descriptions of diagnostic messages produced by Microsoft Resource Compiler (RC) for Windows NT. Many of these messages appear when RC is not able to compile resources properly. The descriptions clarify the cause of each message.
A capital V in parentheses (V) at the beginning of a message description indicates that the message is displayed only if RC is run with the /V (verbose) option. These messages are generally informative and do not necessarily indicate errors.
+#{bmc bm0.BMP}%XVELT1>index2{bmc bm1.BMP}%L0NW.T
RC Diagnostic Messages
{bmc bm2.BMP}%_ERR_A{bmc bm3.BMP}%_ERR_B{bmc bm4.BMP}%_ERR_C{bmc bm5.BMP}%_ERR_E{bmc bm6.BMP}%_ERR_F{bmc bm7.BMP}%_ERR_I{bmc bm8.BMP}%_ERR_N{bmc bm9.BMP}%_ERR_O{bmc bm10.BMP}%_ERR_R{bmc bm11.BMP}%_ERR_T{bmc bm12.BMP}%_ERR_U{bmc bm13.BMP}%_ERR_V{bmc bm14.BMP}%_ERR_W
- A -
Accelerator Type required (ASCII or VIRTKEY)
The type parameter in the ACCELERATORS statement must contain either the ASCII or VIRTKEY value.
+#{bmc bm0.BMP}%XVELT1>index2{bmc bm1.BMP}%L0NW.T
RC Diagnostic Messages
{bmc bm2.BMP}%_ERR_A{bmc bm3.BMP}%_ERR_B{bmc bm4.BMP}%_ERR_C{bmc bm5.BMP}%_ERR_E{bmc bm6.BMP}%_ERR_F{bmc bm7.BMP}%_ERR_I{bmc bm8.BMP}%_ERR_N{bmc bm9.BMP}%_ERR_O{bmc bm10.BMP}%_ERR_R{bmc bm11.BMP}%_ERR_T{bmc bm12.BMP}%_ERR_U{bmc bm13.BMP}%_ERR_V{bmc bm14.BMP}%_ERR_W
- B -
BEGIN expected in Accelerator Table
An ACCELERATORS statement was not followed by the BEGIN keyword.
BEGIN expected in Dialog
A DIALOG statement was not followed by the BEGIN keyword.
BEGIN expected in menu
A MENU statement was not followed by the BEGIN keyword.
BEGIN expected in RCData
An RCDATA statement was not followed by the BEGIN keyword.
BEGIN expected in String Table
A STRINGTABLE statement was not followed by the BEGIN keyword.
BEGIN expected in VERSIONINFO resource
A VERSIONINFO statement was not followed by the BEGIN keyword.
Bitmap file resource-file is not in version-number format.
Use Microsoft Image Editor (IMAGEDIT.EXE) to convert old resource files to the current format.
+#{bmc bm0.BMP}%XVELT1>index2{bmc bm1.BMP}%L0NW.T
RC Diagnostic Messages
{bmc bm2.BMP}%_ERR_A{bmc bm3.BMP}%_ERR_B{bmc bm4.BMP}%_ERR_C{bmc bm5.BMP}%_ERR_E{bmc bm6.BMP}%_ERR_F{bmc b m7.BMP}%_ER R_I{bmc bm8.BM P}%_ERR_N{bmc bm9.BMP}%_ERR_O{bmc bm10.BMP}%_ERR_R{bmc bm11.BMP}%_ERR_T{bmc bm12.BMP}%_ERR_U{bmc bm13.BMP}%_ERR_V{bmc bm14.BMP}%_ERR_W
- C -
Cannot Re-use String Constants
You are using the same value twice in a STRINGTABLE statement. Make sure that you have not mixed overlapping decimal and hexadecimal values.
Control Character out of range [A - Z]
A control character in the ACCELERATORS statement is invalid. The character following the caret (^) must be in the range A through Z.
Could not open in-file-name
Microsoft Windows Resource Compiler (RC) could not open the specified file. Make sure that the file exists and that you typed the filename correctly.
Couldn't open resource-name
Microsoft Windows Resource Compiler (RC) could not open the specified file. Make sure that the file exists and that yo u typed the filename correctly.
Creating resource-name
(V) Microsoft Windows Resource Compiler (RC) is creating a new binary resource (.RES) file.
+#{bmc bm0.BMP}%XVELT1>index2{bmc bm1.BMP}%L0NW.T
RC Diagnostic Messages
{bmc bm2.BMP}%_ERR_A{bmc bm3.BMP}%_ERR_B{bmc bm4.BMP}%_ERR_C{bmc bm5.BMP}%_ERR_E{bmc bm6.BMP}%_ERR_F{bmc bm7.BMP}%_ERR_I{bmc bm8.B MP}%_ERR_N{bmc bm9.BMP}%_ERR_O{bmc bm10.BMP}%_ERR_R{bmc bm11.BMP}%_ERR_T{bmc bm12.BMP}%_ERR_U{bmc bm13.BMP}%_ERR_V{bmc bm14.BMP}%_ERR_W
- E -
Empty menus not allowed
An END keyword appears before any menu items are defined in the MENU statement. Empty menus are not permitted by Microsoft Windows Resource Compiler (RC). Make sure that you do not have any opening quotation marks within the MENU statement.
END expected in Dialog
The END keyword must appear at the end of a DIALOG statement. Make sure that there are no opening quotation marks left from the preceding statement.
END expected in menu
The END keyword must appear at the end of a MENU statement. Make sure that there are no mismatched BEGIN and END statements.
Error Creating resource-name
Microsoft Windows Resource Compiler (RC) could not create the specified binary resource (.RES) file. Make sure that it is not being created on a read-only drive. Use the -V option to find out whether the file is being created.
Expected Comma in Accelerator Table
Microsoft Windows Resource Compil er (RC) requires a comma between the event and idvalue parameters in the ACCELERATORS statement.
Expected control class name
The class parameter of a CONTROL statement in the DIALOG statement must be one of the following control types: BUTTON, COMBOBOX, EDIT, LISTBOX, SCROLLBAR, STATIC, or user-defined. Make sure that the class is spelled correctly.
Expected font face name
The typeface parameter of the FONT statement in the DIALOG statement must be a character string enclosed in double quotation marks. This parameter specifies the name of a font.
Expected ID value for Menuitem
The MENU statement must contain a MENUITEM statement, which has either an integer or a symbolic constant in the MenuID parameter.
Expected Menu String
Each MENUITEM and POPUP statement must contain a text parameter. This parameter is a string enclosed in double quotation marks that specifies the name of the menu item or pop-up menu. A MENUITEM SEPARATOR statement requires no quoted string.
Expected numeric command value
Microsoft Windows Resource Compiler (RC) was expecting a numeric idvalue parameter in the ACCELERATORS statement. Make sure that you have used a #define constant to specify the value and that the constant used is spelled correctly.
Expected numeric constant in string table
A numeric constant, defined in a #define statement, must immediately follow the BEGIN keyword in a STRINGTABLE statement.
Expected numeric point size
The pointsize parameter of the FONT statement in the DIALOG statement must be an integer point-size value.
Expected Numerical Dialog constant
A DIALOG statement requires integer values for the x, y, width, and height parameters. Make sure that these values, which are included after the DIALOG keyword, are not negative.
Expected String in STRINGTABLE
A string is expected after each numeric stringid parameter in a STRINGTABLE statement.
Expected String or Constant Accelerator command
Microsoft Windows Resource Compiler (RC) was not able to determine which key was being set up for the accelerator. The event parameter in the ACCELERATORS statement might be invalid.
Expected VALUE, BLOCK, or END keyword.
The VERSIONINFO structure requires a VALUE, BLOCK, or END keyword.
Expecting number for ID
A number is expected for the id parameter of a CONTROL statement in the DIALOG statement. Make sure that you have a number or a #define statement for the control identifier.
Expecting quoted string for key
The key string following the BLOCK or VALUE keyword should be enclosed in double quotation marks.
Expecting quoted string in dialog class
The class parameter of the CLASS statement in the DIALOG statement must be an integer or a string enclosed in double quotation marks.
Expecting quoted string in dialog title
The captiontext parameter of the CAPTION statement in the DIALOG statement must be a character string, enclosed in double quotation marks.
+#{bmc bm0.BMP}%XVELT1>index2{bmc bm1.BMP}%L0NW.T
RC Diagnostic Messages
{bmc bm2.BMP}%_ERR_A{bmc bm3.BMP}%_ERR_B{bmc bm4.BMP}%_ERR_C{bmc bm5.BMP}%_ERR_E{bmc bm6.BMP}%_ERR_F{bmc bm7.BMP}%_ERR_I{bmc bm8.BMP}%_ERR_N{bmc bm9.BMP}%_ERR_O{bmc bm10.BMP}%_ERR_R{bmc bm11.BMP}%_ERR_T{bmc bm12.BMP}%_ERR_U{bmc bm13.BMP}%_ERR_V{bmc bm14.BMP}%_ERR_W
- F -
File not found: filename
The file specified in the rc command was not found. Make sure that the file has not been moved to another directory and that the filename or path is typed correctly.
Font names must be ordinals
The pointsize parameter in the FONT statement must be an integer, not a string.
+#{bmc bm0.BMP}%XVELT1>index 2{bmc bm1.BMP}%L0NW.T
RC Diagnostic Messages
{bmc bm2.BMP}%_ERR_A{bmc bm3.BMP}%_ERR_B{bmc bm4.BMP}%_ERR_C{bmc bm5.BMP}%_ERR_E{bmc bm6.BMP}%_ERR_F{bmc bm7.BMP}%_ERR_I{bmc bm8.BMP}%_ERR_N{bmc bm9.BMP}%_ERR_O{bmc bm10.BMP}%_ERR_R{bmc bm11.BMP}%_ERR_T{bmc bm12.BMP}%_ERR_U{bmc bm13.BMP}%_ERR_V{bmc bm14.BMP}%_ERR_W
- I -
Invalid Accelerator
An event parameter in the ACCELERATORS statement was not recognized or was more than two characters long.
Invalid Accelerator Type (ASCII or VIRTKEY)
The type parameter in the ACCELERATORS statement must contain either the ASCII or VIRTKEY value.
Invalid control character
A control character in the ACCELERATORS statement is invalid. A valid control character consists of a caret (^) followed by a single letter.
Invalid Control type
The CONTROL statement in a DIALOG statement must be one of the following: AUTO3STATE, AUTOCHECKBOX, AUTORADIOBUTTON, CHECKBOX, COMBOBOX, CONTROL, CTEXT, DEFPUSHBUTTON, EDITTEXT, GROUPBOX, ICON, LISTBOX, LTEXT, PUSHBOX, PUSHBUTTON, RADIOBUTTON, RTEXT, SCROLLBAR, STATE3.
Invalid directive in preprocessed RC file
The specified filename has an embedded newline character.
Invalid .EXE file
The executable (.EXE) file is invalid. Make sure that the linker created it correctly and that the file exists.
Invalid switch, option
An option used was invalid. For a list of the command-line options, use the RC /? command.
Invalid switch, too many -D switches
Too many /D options were specified. To define a large number of symbols, use the #include directive to include a file of definitions.
Invalid type
The resource type was not amon g the types defined in the include file.
Invalid usage. Use RC -? for Help
Make sure that you have at least one filename to work with. For a list of the command-line options, use the RC /? command.
I/O error reading file.
Read failed. Since this is a generic routine, no specific filename is supplied.
I/O error seeking in file
Seeking in file failed. Since this is a generic routine, no specific filename is supplied.
I/O error writing file.
Write failed. Since this is a generic routine, no specific filename is supplied.
+#{bmc bm0.BMP}%XVELT1>index2{bmc bm1.BMP}%L0NW.T
RC Diagnostic Messages
{bmc bm2.BMP}%_ERR_A{bmc bm3.BMP}%_ERR_B{bmc bm4.BMP}%_ERR_C{bmc bm5.BMP}%_ERR_E{bmc bm6.BMP}%_ERR_F{bmc bm7.BMP}%_ERR_I{bmc bm8.BMP}%_ERR_N{bmc bm9.BMP}%_ERR_O{bmc bm10.BMP}%_ERR_R{bmc bm11.BMP}%_ERR_T{bmc bm12.BMP}%_ERR_U{bmc bm13.BMP}%_ERR_V{bmc bm14.BMP}%_ERR_W
- N -
No resource binary filename specified.
The /FO option was used, but no binary resource (.RES) file was specified.
+#{bmc bm0.BMP}%XVELT1>index2{bmc bm1.BMP}%L0NW.T
RC Diagnostic Messages
{bmc bm2.BMP}%_ERR_A{bmc bm3.BMP}%_ERR_B{bmc bm4.BMP}%_ERR_C{bmc bm5.BMP}%_ERR_E{bmc bm6.BMP}%_ERR_F{bmc bm7.BMP}%_ERR_I{bmc bm8.BMP}%_ERR_N{bmc bm9.BMP}%_ERR_O{bmc bm10.BMP}%_ERR_R{bmc bm11.BMP}%_ERR_T{bmc bm12.BMP}%_ERR_U{bmc bm13.BMP}%_ERR_V{bmc bm14.BMP}%_ERR_W
- O -
Old DIB in resource-name. Pass it through IMAGEDIT.
The resource file specified is not compatible with Win32. Make sure you have read and saved this file using the latest version of Microsoft Image Editor (IMAGEDIT.EXE).
Out of heap memory
There was not enough memory.
Out of memory, needed n bytes
Microsoft Windows Resource Compiler (RC) was not able to allocate the specified amount of memory.
+#{bmc bm0.BMP}%XVELT1>index2{bmc bm1.BMP}%L0NW.T
RC Diagnostic Messages
{bmc bm2.BMP}%_ERR_A{bmc bm3.BMP}%_ERR_B{bmc bm4.BMP}%_ERR_C{bmc bm5.BMP}%_ERR_E{bmc bm6.BMP}%_ERR_F{bmc bm7.BMP}%_ERR_I{bmc bm8.BMP}%_E RR_N{bmc bm9.BMP}%_ERR_O{bmc bm10.BMP}%_ERR_R{bmc bm11.BMP}%_ERR_T{bmc bm12.BMP}%_ERR_U{bmc bm13.BMP}%_ERR_V{bmc bm14.BMP}%_ERR_W
- R -
Redefinition of Button Type
The specified button styles conflict with or modify the style specified by the control keyword. This is a warning only and may be ignored.
The following common method of declaring an automatic radio button generates this warning:
RADIOBUTTON "&Italic", MYRB_ITALIC, 10, 10, 30, 12, BS_AUTORADIOBUTTON

To avoid the warning, use the control statement appropriate for the type of button that you want to define. In this example, the corrected statement is:
AUTORADIOBUTTON "&Italic", MYRB_ITALIC, 10, 10, 30, 12

RC: Invalid switch: option
An option used was invalid. For a list of the command-line options, use the RC /? command.
RC terminated by user
A CTRL+C key combination was pressed, exiting Microsoft Windows Resource Compiler (RC).
RC terminating after preprocessor errors
For information about preprocessor errors, see the documentation f or the preprocessor.
Resource file resource-name is not in version-number format.
Make sure your icons and cursors have been read and saved using the latest version of Microsoft Image Editor (IMAGEDIT.EXE).
+#{bmc bm0.BMP}%XVELT1>index2{bmc bm1.BMP}%L0NW.T
RC Diagnostic Messages
{bmc bm2.BMP}%_ERR_A{bmc bm3.BMP}%_ERR_B{bmc bm4.BMP}%_ERR_C{bmc bm5.B MP}%_ERR_E{bm c bm6.BMP}%_ERR_F{bmc bm7.BMP}%_ERR_I{bmc bm8.BMP}%_ERR_N{bmc bm9.BMP}%_ERR_O{bmc bm10.BMP}%_ERR_R{bmc bm11.BMP}%_ERR_T{bmc bm12.BMP}%_ERR_U{bmc bm13.BMP}%_ERR_V{bmc bm14.BMP}%_ERR_W
- T -
Text string or ordinal expected in Control
The text parameter of a CONTROL statement in the DIALOG statement must be either a text string or an ordinal reference to the type of control that is expected. If using an ordinal, make sure that you have a #define statement for the control.
+#{bmc bm0.BMP}%XVELT1>index2{bmc bm1.BMP}%L0NW.T
RC Diagnostic Messages
{bmc bm2.BMP}%_ERR_A{bmc bm3.BMP}%_ERR_B{bmc bm4.BMP}%_ERR_C{bmc bm5.BMP}%_ERR_E{bmc bm6.BMP}%_ERR_F{bmc bm7.BMP}%_ERR_I{bmc bm8.BMP}%_ERR_N{bmc bm9.BMP}%_ERR_O{bmc bm10.BMP}%_ERR_R{bmc bm11.BMP}%_ERR_T{bmc bm12.BMP}%_ERR_U{bmc bm13.BMP}%_ERR_V{bmc bm14.BMP}%_ERR_W
- U -
Unable to create destination
Microsoft Windows Resource Compiler (RC) was not able to create the destination file. Make sure that there is enough disk space.
Unbalanced Parentheses
Make sure that you have closed every opening parenthesis in the DIALOG statement.
Unexpected value in RCData
The values for the raw-data parameter in the RCDATA statement must be integers or strings, separated by commas. Make sure that you did not leave out a comma or a quotation mark around a string.
Unexpected value in value data
A statement contained information with a format or size different from the expected value for that parameter.
Unknown DIB header format
The device-independent bitmap (DIB) header is not a BITMAPCOREHEADER or BITMAPINFOHEADER structure.
Unknown Menu SubType
The item-definitions parameter of the MENU statement can contain only MENUITEM and POPUP statements.
Unrecognized VERSIONINFO field; BEGIN or comma expected
The format of the information following a VERSIONINFO statement is incorrect.
+#{bmc bm0.BMP}%XVELT1>index2{bmc bm1.BMP}%L0NW.T
RC Diagnostic Messages
{bmc bm2.BMP}%_ERR_A{bmc bm3.BMP}%_ERR_B{bmc bm4.BMP}%_ERR_C{bmc bm5.BMP}%_ERR_E{bmc bm6.BMP}%_ERR_F{bmc bm7.BMP}%_ERR_I{bmc bm8.BMP}%_ERR_N{bmc bm9.BMP}%_ERR_O{bmc bm10.BMP}%_ERR_R{bmc bm11.BMP}%_ERR_T{bmc bm12.BMP}%_ERR_U{bmc bm13.BMP}%_ERR_V{bmc bm14.BMP}%_ERR_W
- V -
Version WORDs separated by commas expected
Values in an information block for a VERSIONINFO statement should be separated by commas.
+#{bmc bm0.BMP}%XVELT1>index2{bmc bm1.BMP}%L0NW.T
RC Diagnostic Messages
{bmc bm2.BMP}%_ERR_A{bmc bm3.BMP}%_ERR_B{bmc bm4.BMP}%_ERR_C{bmc bm5.BMP}%_ERR_E{bmc bm6.BMP}%_ERR_F{bmc bm7.BMP}%_ERR_I{bmc bm8.BMP}%_ERR_N{bmc bm9.BMP}%_ERR_O{bmc bm10.BMP}%_ERR_R{bmc bm11.BMP}%_ERR_T{bmc bm12.BMP}%_ERR_U{bmc bm13.BMP}%_ERR_V{bmc bm14.BMP}%_ERR_W
- W -
Warning: ASCII character not equivalent to virtual key code
An invalid virtual-key code exists in the ACCELERATORS statement. The ASCII values for some characters such as *, ^, or & are not equivalent to the virtual-key codes for the corresponding keys. In the case of the asterisk [*], the virtual-key code is equivalent to the ASCII value for 8, the numeric character on the same key. Therefore, the statement VIRTKEY '* ' is invalid.
Warning: SHIFT or CONTROL used without VIRTKEY
The ALT, SHIFT, and CONTROL options apply only to virtual keys in the ACCELERATORS statement. Make sure that the VIRTKEY option is used with one of these other options.
Writing resource type image lang:language size:size
(V) Microsoft Windows Resource Compiler (RC) is writing the specified resource. The type is the resource type. It may be a number or a string. The image can be a number or a string. The language is the national language of the resource. The size is the decimal size of the resource in byt e s.

#{bmc bm15.BMP}%67U JIQ>index2{bmc bm16.BMP}%!CloseWindow("")
Resource Compiler Outline
Resource Compiler50890H0>main
Including Resources in an Application.X2HNW>main
Creating a Resource-Definition File427O2DB>main
Preprocessing DirectivesH.3QDN>main
Single-Line Statements1DSSWOK>main
Multiline Statements1VYW4OO>main
 Sample Resource-Definition File1GRB.VF>main
Using RC (The RC Command Line)Q21XEK>mai n
Defining Names for the Preprocessor11C18WU>main
Renaming the Compiled Resource File3NWJR.8>main
Searching for Files10IXKA9>main
Displaying Progress MessagesEJO_NW>main
Resource-Definition StatementsS69MTP>main
Common Statement ParametersXZYYJY>main
Common Resource AttributesG1NESG>main
Statement Reference67UJIQ>index2
Preprocessing Reference1MISHD_>main
RC Diagnostic MessagesL0NW.T>main
#{bmc bm15.BMP}%XVELT1>index2{bmc bm16.BMP}%!CloseWindow("")
Resource Compiler Statements
Common Statement ParametersXZYYJY>main
Common Resource AttributesG1NESG>main
ACCELERATORS Resource7GJLS6>main
AUTO3STATE Control132D4.2>main
AUTOCHECKBOX ControlFAUEF2>main
AUTORADIOBUTTON ControlH7WDGT>main
BITMAP ResourceFEGV3M>main
CAPTION Statement95HK82>main
CHARACTERISTICS StatementAFGW2L>main
CHECKBOX ControlWBG 55P>main
CLASS Statement_CLASS>main
COMBOBOX ControlK1H06L>main
CONTROL: General Control2HOARS5>main
CTEXT Control_CTEXT>main
CURSOR ResourceGQF1AO>main
DEFPUSHBUTTON Control4ADGGCT>main
DIALOG ResourceHE4UAD>main
DIALOGEX Resource7W8NNW>main
EDITTEXT Control3FI5BP5>main
EXSTYLE StatementNGP1DO>main
FONT Resource.OJEZW>main
FONT Statement_FONT>main
GROUPBOX Control2BCDXGQ>main
ICON Resource_ICON>main
ICON Control5_DK_8.>main
LANGUAGE StatementKMK1GX>main
LISTBOX Control10J9ILS>main
LTEXT Control_LTEXT>main
MENU Resource_MENU>main
MENU Statement_1CYE9>main
MENUEX ResourceZ0W4TO>main
MENUITEM Statement3VT9D3>main
MESSAGETABLE Resource1.XLR0G>main
POPUP Resource_POPUP>main
PUSHBOX Control3UNM_T>main
PUSHBUTTON ControlJW7TB5>main
RADIOBUTTON Control7IC1FN>main
RCDATA95VJYY>main
RTEXT Control_RTEXT>main
SCROLLBAR ControlOHPDZB>main
STATE3 Control0FT2JK>main
STRINGTABLE Resource1UH1OD0>main
STYLE Statement1YH0I9>main
User-Defined Resource4MGN46>main
VERSION Statement.5OWYK>main
VERSIONINFO Resource3ZF2OI>main


Dialog Base Units

Différents éléments d'infos

The GetDialogBaseUnits <JavaScript:alink_1.Click()> function returns the dialog base units in pixels. The exact meaning of the coordinates depends on the style defined by the STYLE <rc_3fuc.htm> option statement. For child-style dialog boxes, the coordinates are relative to the origin of the parent window, unless the dialog box has the style DS_ABSALIGN; in that case, the coordinates are relative to the origin of the display screen.
Do not use the WS_CHILD style with a modal dialog box. The DialogBox <JavaScript:alink_2.Click()> function always disables the parent/owner of the newly created dialog box. When a parent window is disabled, its child windows are implicitly disabled. Since the parent window of the child-style dialog box is disabled, the child-style dialog box is too.
If a dialog box has the DS_ABSALIGN style, the dialog coordinates for its upper-left corner are relative to the screen origin instead of to the upper-left corner of the parent window. You would typically use this style when you wanted the dialog box to start in a specific part of the display no matter where the parent window may be on the screen.
The name DIALOG can also be used as the class-name parameter to the CreateWindow <JavaScript:alink_3.Click()> function to create a window with dialog-box attributes.

Remarks ...
TheGetDialogBaseUnits function returns the dialog base units in pixels. The exact meaning of the coordinates depends on the style defined by the STYLE option statement. For child-style dialog boxes, the coordinates are relative to the origin of the parent window, unless the dialog box has the style DS_ABSALIGN; in that case, the coordinates are relative to the origin of the display screen. Do not use the WS_CHILD style with a modal dialog box. TheDialogBox function always disables the parent/owner of the newly created dialog box. When a parent window is disabled, its child windows are implicitly disabled. Since the parent window of the child-style dialog box is disabled, the child-style dialog box is too. If a dialog box has the DS_ABSALIGN style, the dialog coordinates for its upper-left corner are relative to the screen origin instead of to the upper-left corner of the parent window. You would typically use this style when you wanted the dialog box to start in a specific part of the display no matter where the parent window may be on the screen. The name DIALOG can also be used as the class-name parameter to theCreateWindow function to create a window with dialog-box attributes.

Comments ...
The GetDialogBaseUnits function returns the dialog base units in pixels. The exact meaning of the coordinates depends on the style defined by the STYLE option statement. For child-style dialog boxes, the coordinates are relative to the origin of the parent window, unless the dialog box has the style DS_ABSALIGN; in that case, the coordinates are relative to the origin of the display screen.

+$#A Dialog Box Measurements ...
Every dialog box template contains measurements that specify the position, width, and height of the dialog box and the controls it contains. These measurements are device independent, so an application can use a single template to create the same dialog box for all types of display devices. This ensures that a dialog box will have the same proportions and appearance on all screens despite differing resolutions and aspect ratios between screens. Dialog box measurements are given in dialog base units. One horizontal unit is equal to one-fourth of the average character width for the system font. One vertical unit is equal to one-eighth of the average character height for the system font. An application can retrieve the number of pixels per base unit for the current display by using the GetDialogBaseUnits function. An application can convert measurements from dialog base units to pixels by using the MapDialogRect function. The template must specify the initial coordinates of the upper left corner of the dialog box. Usually the coordinates are relative to the upper left corner of the owner window's client area. When the template specifies the DS_ABSALIGN style or the dialog box has no owner, the position is relative to the upper left corner of the screen. Windows sets this initial position when creating the dialog box, but permits an application to adjust the position before displaying the dialog box. For example, an application can retrieve the dimensions of the owner window, calculate a new position that centers the dialog box in the owner window, and then set the position by using the SetWindowPos function. The template should specify a dialog box width and height that does not exceed the width and height of the screen and ensures that all controls and are within the client area of the dialog box. Although Windows permits a dialog box to be any size, creating one that is too small or too large can prevent the user from providing input, defeating the purpose of the dialog box. Many applications use more than one dialog box when there are a large number of controls. In such cases, the initial dialog box usually contains one or more buttons that the user can choose to display the next dialog box.


D:\Com_CHM\CHM Prgm API\RC Resource Compiler\______Collect\toto BC555.rtf

Resource shell (BRC32)

See also Examples
-----------------------------------------

The Borland resource compiler (BRC32) is a resource compiler shell. It invokes BRCC32 and RLINK32, depending on the command-line syntax.

Syntax

brc32 [options] <filename>.RC [<filename>.EXE]

Command-line options

BRC32 accepts these options:

Switch Description

-d<name>[=string] Defines a symbol you can test with the #IFDEF preprocessor directive.
-fo<filename> Renames the .RES file.
-fe<filename> Renames the .EXE file.
-i<path> Adds one or more directories (separated by semicolons) to the include search path.
-r Creates a .RES file only. The compiled .RES file is not added to the .EXE.
-v Prints progress messages (verbose listing).
-x Directs the compiler to ignore the INCLUDE environment variable when it searches for include or resource files.

-16 Builds 16-bit .RES files.
-32 Builds 32-bit .RES files.
-Vd.d Makes the .EXE file with Windows version provided (v3.1 is the default for 16-bit resources; -v4.0 is the default for 32-bit resources). Version options are listed in the following table.

Option Bit Resulting look

3.1 16 Gives white background with a non 3-D look for Windows 3.1x, Windows 32s, or WinNT 3.1
4.0 16 Gives gray 3-D look for Windows 95 and WinNT 3.51
3.1 32 Gives white background with a non 3-D look for Windows 32s or WinNT 3.1
4.0 32 Gives gray 3-D look for Windows 95 and WinNT 3.51

The following switches are invalid when the -r switch is specified:

-k Disables the contiguous preload of segments and resources in the .EXE file. Segments are kept in the order in which they appear in the .DEF file. (This option only applies to 16-bit resources.)
-t Creates an application that runs only in protected mode (Windows Standard or 386 Enhanced mode).

Downward compatibility

The following syntax and options are supported for downward compatibility

Syntax

brc32 [switches] <filename>.RC [<filename>.EXE]

Command-line options

BRC32 accepts these options:

Option Description

-31 Builds Windows 3.1-compatible .RES files.
-w32 Builds Win32-compatible .RES files.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Resource compiler (BRCC32)

See also Examples
--------------------------------------------
BRCC32 is the command-line version of the resource compiler. It accepts a resource script file (.RC) as input and produces a resource object file (.RES) as output.

Syntax

BRCC32 [options] <filename>.RC

Command-line options

BRCC32 accepts these options:

Option Description

@responsefile Takes instructions from the specified command file.
-c <code page> Uses the specified code page for resource translation. If -c is not used, the default ANSI code page is used.
-d<name>[=<string>] Defines a preprocessor symbol.
-fo<filename> Renames the output .RES file. (By default, BRCC32 creates the output .RES file with the same name as the input .RC file.)
-i<path> Adds one or more directories (separated by semicolons) to the include search path.

-l<language> Specifies default language.
-m Indicates that the code page specified with the -c switch contains double-byte character set (DBCS) characters.
-r This switch is ignored. It is included for compatibility with other resource compilers.
-v Prints progress messages (verbose).
-x Deletes the current include path.
-? or -h Displays help.
-16 Builds a 16-bit resource.
-32 Builds a 32-bit resource.

BRCC32 predefines common resource-related Windows constants such as WS_VISIBLE and BS_PUSHBUTTON. Also, two special compiler-related symbols are defined: RC_INVOKED and WORKSHOP_INVOKED. These symbols can be used in the source text in conjunction with conditional preprocessor statements to control compilation. For example, the following construct can greatly speed up compilation:

#ifndef WORKSHOP_INVOKED

#include "windows.h"

#endif

Downward compatibility

The following syntax and options are supported for downward compatibility:

Syntax

BRCC32 [options] <filename>.RC

Command-line options

BRCC32 accepts these options:

Option Description

-31 Builds Windows 3.1-compatible .RES files.
-w32 Builds Win32-compatible .RES files.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Resources Visual_BASIC_5

Resources provide a mechanism for including various objects and data in an executable file. Visual Basic is able to add many types of resources to an application by way of a resource file. In order to understand both the features and limitations of the resource mechanism, it is first necessary to understand what resources are and how they work with regular Windows applications.

Resources and Windows Applications

Some of the objects that are used under Windows can have a great deal of data associated with them. Consider, for example, the case of a font.
A font has associated with it all the data in the TEXTMETRIC structure introduced in Chapter 11. It also contains all the information needed to actually draw each character, and the spacing information needed to draw a text string. This can easily total thousands of bytes of data.
Icons are another example of an object that requires a fair amount of data. On a 16-color VGA monitor, the typical 32x32 pixel icon requires 512 bytes for one device-independent bitmap, an additional 128 bytes for the monochrome mask, and additional space for the icon header information.

Other objects that can take large amounts of data are bitmaps, strings, and cursors.
In many cases, it is desirable to include one or more of these objects in an executable file. This poses an interesting problem. In C or Pascal it is possible to hard code the data-to create static data structures that have the binary data defined. But this approach is tricky. First, it can be excruciatingly difficult to program. Imagine writing out the pattern for a bitmap in hexadecimal! Second, this approach makes it extremely difficult to change the object, a problem if you need to support several languages in your program for use in foreign countries.

Windows solves this problem through a mechanism called Windows resources. A resource is a block of data that represents a Windows object such as a cursor, icon, bitmap, font, or string. Each Windows executable file contains a resource table that lists the resources in the file. The Windows API contains functions that allow you to load these resources.
Each resource is created using an appropriate tool. Icons, bitmaps, and cursors are created with specialized image drawing programs. The Iconwrks program provided with Visual Basic is an example of an icon editor. Strings are created using a text editor. Fonts are created using special font editing programs.

Once the data for each object is created, a special tool known as a resource compiler combines the objects into a single resource file. The resource editor can then be used to insert the resource file into an executable file. Figure 15.8 illustrates the sequence of operations needed to add resources to an executable file.

Figure 15.8

The resource compiler makes use of a special resource definition file that lists the resources to include. It can also be used to define dialog boxes, menus, and even user-defined resources.

You might consider the entire concept of resources to be an incredibly powerful and flexible equivalent to the BASIC “Data” statement, except that you can save not only strings, but virtually any type of data object. Once resources are included in an executable file, they can be loaded by the application as needed.
One of the powerful subtleties of this approach becomes clear when you consider the fact that any application can load the resources contained in any executable file, including dynamic link libraries. For example, it is possible to create a dynamic link library that has no functions or program code at all-only hundreds of icon resources that are available to any application.

One of the other advantages of the Windows resource mechanism is that resources are loaded only as needed. Not only that, but Windows can discard them if necessary and reload them automatically when they are again required.

All of the material presented here is copyrighted by either Desaware or Macmillan. No part of this material may be used or reproduced in any fashion (except in brief quotations used in critical articles and reviews) without prior consent.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Resource API Functions

Every resource must have a unique type and a unique name or identifier, each of which can take two forms: a string or an integer. Windows defines a number of standard resource types, which are listed in Table 15.6. These types are integer constants with the constant names shown in the table.
Table 15.6 Resource Types

Constant Value Description
        RT_ACCELERATOR	An accelerator table. Not useful in Visual Basic.
        RT_BITMAP     	A bitmap. May be loaded with the LoadBitmap function.
        RT_DIALOG     	A dialog box. Dialog resources are not useful in Visual Basic.
        RT_FONT	        A font. Can be used with the AddFontResource function.
        RT_FONTDIR    	A font directory.
        RT_MENU       	A menu resource. Not useful in Visual Basic.
        RT_RCDATA	        Raw data stream.
        RT_STRING	        A string resource. May be loaded with the LoadString function.
        RT_MESSAGETABLE	A message table.
        RT_CURSOR	        A cursor. May be loaded with the LoadCursor function.
        RT_GROUP_CURSOR	  A cursor (hardware independent).
        RT_ICON	        An icon. May be loaded with the LoadIcon function.
        RT_GROUP_ICON	  An icon (hardware independent).
        RT_VERSION    	A version resource. Use the version API functions described in Chapter 13 to access these resources.
Other integer value
0-32767 Either a standard resource type not defined here, or an application defined resource type.
Any string A standard resource type, such as “TYPELIB,” which identifies a type library, or an application defined resource type.
An application can define its own resource types using other integer values or type names. Each resource must also have a unique name. For example, an icon resource can have the name “Icon1.” You would pass the string “Icon1” to the resource API functions when you wish to access or load this icon.
In order to save space, however, most resources are identified by an integer. Most of the resource API functions expect the resource identifier to be a 32-bit long parameter. If the high-order 16 bits are zero, the function assumes that the low-order 16 bits contain the integer identifier. Otherwise the function assumes that the parameter is a 32-bit pointer to a null terminated string containing the name of the resource.

Win32 has improved on Win16 with regard to its ability to browse through existing resources in a file, eliminating the need to examine an executable directly to determine what resources it contains.
Most of the resource access functions that a Visual Basic programmer would use are defined in the chapters that describe the associated Windows object. For example, the LoadBitmap API function used to load bitmap resources is described in Chapter 9 with the other bitmap functions.

Most of the resource API functions described in Table 15.7 are thus rarely used in Visual Basic. These functions are used internally by Windows to implement specific resource functions such as LoadBitmap and LoadIcon. They are made available through the Windows API primarily in order to support user-defined resources. Refer to the function reference for an outline of how they are used.
Table 15.7 General Resource Functions

Function Description
ABC
        BeginUpdateResource	     Starts a resource update operation
        CreateIconFromResourceCreateIconFromResourceEx	Creates an icon handle given a block of memory in a resource file
        EndUpdateResource	     Ends a resource update operation
        EnumResourceLanguages	     Enumerates all of the languages for a particular resource
        EnumResourceNames	     Enumerates all of the resources for a given resource type
        FindResource
        FindResourceEx	             Finds a resource in an executable file
        FreeResource                 Frees a resource
        LoadResource	             Loads a resource into memory
        LoadString	             Loads a string resource
        LockResource	             Obtains a pointer to a resource in memory
        LookupIconIdFromDirectoryLookupIconIdFromDirectoryEx	Finds the icon resource that best suits the current display
        SizeofResource	             Determines the size of a resource
        UpdateResource	             Updates a resource in a file
The general sequence of operations is as follows:

1. Use the FindResource function to obtain a resource information handle.
2. Use the LoadResource function to obtain a handle to the resource and to load the resource.
3. Use the LockResource function to lock the resource and obtain a pointer to the resource data.
4. Use the GlobalUnlock function to unlock the resource.
5. Use the FreeResource function to free the memory used by the resource and the resource handle.

A simple font resource browser project, resource.vbp, is included on the CD-ROM source code directory for this chapter. Extending this sample to actually show the resources that it lists is left as an exercise for the reader.

All of the material presented here is copyrighted by either Desaware or Macmillan. No part of this material may be used or reproduced in any fashion (except in brief quotations used in critical articles and reviews) without prior consent.

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

The Version Resource Data Structures

The version stamp for a file can have many different components depending on the file. Three of these are commonly used by installing programs and are used in virtually all programs that use version stamping. The first component is a data structure known as the VS_FIXEDFILEINFO structure. (Note: This structure was simply called FIXEDFILEINFO under Win16.) It contains numeric version information and flags defining the type of the file. The second component defines the language and code page translations that exist in the version resource. The third component consists of one or more strings called StringFileInfo attributes.

The VS_FIXEDFILEINFO Structure

The VS_FIXEDFILEINFO data structure is present in every file that has a version stamp. It is defined below.

VB Declaration
Type VS_FIXEDFILEINFO ' 52 Bytes
        dwSignature        As Long
        dwStrucVersion     As Long
        dwFileVersionMS    As Long
        dwFileVersionLS    As Long
        dwProductVersionMS As Long
        dwProductVersionLS As Long
        dwFileFlagsMask    As Long
        dwFileFlags        As Long
        dwFileOS           As Long
        dwFileType         As Long
        dwFileSubtype      As Long
        dwFileDateMS       As Long
        dwFileDateLS       As Long
End Type

Field Type/Description
        dwSignature	            Long-Always contains &HFEEF04BD.
        dwStrucVersion              Long-The version of this structure. Will be greater than &H29.
        dwFileVersionMS        	    Long-The high 32 bits of the file version number.
        dwFileVersionLS        	    Long-The low 32 bits of the file version number.
        dwProductVersionMS     	    Long-The high 32 bits of the product version number.
        dwProductVersionLS     	    Long-The low 32 bits of the product version number.
        dwFileFlagsMask        	    Long-Any combination of the constants in Table 13.10. The presence of a flag in this parameter indicates that the value of the dwFileFlags parameter for that bit is valid.
        dwFileFlags         		Long-Any combination of the constants in Table 13.10.
        dwFileOS            		Long-One of the constants defined in Table 13.11 to specify the operating system for which this file was designed.
        dwFileType          		Long-One of the constants defined in Table 13.12 to specify the type of file.
        dwFileSubtype       		Long-One of the constants defined in the API32.TXT file that begin with the VFT2_ prefix.
        dwFileDataMS        		Long-The high 32 bits that specify the date and time of the file’s creation. There is no guarantee that this field will be set by the compiler.
        dwFileDataLS        		Long-The low 32 bits that specify the date and time of the file’s creation. There is no guarantee that this field will be set by the compiler.
Version numbers are typically 64-bits long to allow for numeric comparisons of versions. However, the internal structure of these numbers deserves further clarification.
On the most significant 32 bits, the high 16 bits comprise the major revision number, and the low 16 bits comprise the minor revision number. Thus Windows 3.10 will have &H0003000A in its major version number. The 3 in the high-order word indicates version 3, and the hexadecimal A represents the number 10 for a minor revision number of .10. This technique is used on the lower 32 bits to allow even finer resolution of versions, but these numbers are typically used only in a development environment and are rarely used by either application programmers or users. It is essential that you use the revision numbers from the VS_FIXEDFILEINFO structure when comparing file versions-do not use the FileVersion text string that will be described shortly. A text comparison on that string will not reliably compare file versions.

Table 13.10 lists the flags that are used in the dwFileFlags parameter to specify general information about the file.
Table 13.10 Version File Flags

Constants Description
        VS_FF_DEBUG	           This file contains debugging information.
        VS_FF_INFOINFERRED       The version resource for this file is dynamically allocated and some of the blocks in the resource may be incorrect.
        VS_FF_PATCHED	           This file has been patched. It may differ from the original file that has the same version number.
        VS_FF_PRERELEASE	   This is a prerelease version of the file.
        VS_FF_PRIVATEBUILD       This version of the file is built specially as defined by the PrivateBuild StringFileInfo string.
        VS_FF_SPECIALBUILD       This version of the file is built specially as defined by the SpecialBuild StringFileInfo string.
        Table 13.11              lists the constants that are used in the dwFileType parameter to specify the file type.
        Table 13.11	           Version File Operating System Types

Constant Target Operating System for This File
VOS_UNKNOWN	             Undefined or unknown

VOS_DOS	MS-DOS

        VOS_DOS_WINDOWS16	16-bit Windows on DOS (Windows 3.0, 3.1)
        VOS_DOS_WINDOWS32	32-bit Windows on DOS (Win32s)
        VOS_NT                  Windows NT
        VOS_OS216	        16-bit OS/2
        VOS_OS232	        32-bit OS/2
        VOS_OS216_PM16 	  16-bit Presentation Manager on 16 bit OS/2
        VOS_OS232_PM32	  32-bit Presentation Manager on 32 bit OS/2
        VOS_PM16	        16-bit Presentation Manager
        VOS_PM32	        32-bit Presentation Manager
        VOS_WINDOWS32	32-bit Windows
        VOS_NT_WINDOWS32    Win32 API on Windows NT
        Table 13.12         lists the constants that are used in the dwFileOS parameter to specify the target operating system for the file.
        Table 13.12	      Version File Types

Constant Type of File
        VFT_UNKNOWN	     Unknown
        VFT_APP   	     Application
        VFT_DLL	     Dynamic link library-this includes most Visual Basic custom controls
        VFT_DRV	     Driver type is specified by the dwFileSubType parameter
        VFT_FONT	     Font type is specified by the dwFileSubType parameter
        VFT_VXD	     Virtual device driver
        VFT_STATIC_LIB   A static link library

All of the material presented here is copyrighted by either Desaware or Macmillan. No part of this material may be used or reproduced in any fashion (except in brief quotations used in critical articles and reviews) without prior consent.


D:\Com_CHM\CHM Prgm API\RC Resource Compiler\______Collect\BRC32.rtf

BORLAND BRC32.exe Documentation

Using command-line resource tools

There are several Borland command-line resource tools:

Resource compiler

BRCC32.EXE is the Borland resource compiler. It compiles resource script
files (.RC files) and produces the binary .RES file.

Resource linkers

RLINK32.DLL is the Borland resource linker that binds resources, in .RES
file form, to an .EXE file, and marks the resulting .EXE file as a Windows
executable. RLINK32.DLL is accessed through ILINK32.EXE.

Resource shells

BRC32.EXE is a shell through which BRCC32 and RLINK32 (through ILINK32) can
be started in a single step.

------------

Resource compiler (BRCC32)

See also Examples

BRCC32 is the command-line version of the resource compiler. It accepts a
resource script file (.RC) as input and produces a resource object file
(.RES) as output.

Syntax

BRCC32 [options] <filename>.RC

Command-line options

BRCC32 accepts these options:

Option Description

@responsefile Takes instructions from the specified command file.
-c <code page> Uses the specified code page for resource translation. If -
c is not used, the default ANSI code page is used.
-d<name>[=<string>] Defines a preprocessor symbol.
-fo<filename> Renames the output .RES file. (By default, BRCC32 creates the
output .RES file with the same name as the input .RC file.)
-i<path> Adds one or more directories (separated by semicolons) to the
include search path.

-l<language> Specifies default language.
-m Indicates that the code page specified with the -c switch contains
double-byte character set (DBCS) characters.
-r This switch is ignored. It is included for compatibility with other
resource compilers.
-v Prints progress messages (verbose).
-x Deletes the current include path.
-? or -h Displays help.
-16 Builds a 16-bit resource.
-32 Builds a 32-bit resource.

BRCC32 predefines common resource-related Windows constants such as
WS_VISIBLE and BS_PUSHBUTTON. Also, two special compiler-related symbols
are defined: RC_INVOKED and WORKSHOP_INVOKED. These symbols can be used in
the source text in conjunction with conditional preprocessor statements to
control compilation. For example, the following construct can greatly speed
up compilation:

#ifndef WORKSHOP_INVOKED

#include "windows.h"

#endif

Downward compatibility

The following syntax and options are supported for downward compatibility:

Syntax

BRCC32 [options] <filename>.RC

Command-line options

BRCC32 accepts these options:

Option Description

-31 Builds Windows 3.1-compatible .RES files.
-w32 Builds Win32-compatible .RES files.

--------------------

Resource shell (BRC32)

See also Examples

The Borland resource compiler (BRC32) is a resource compiler shell. It
invokes BRCC32 and RLINK32, depending on the command-line syntax.

Syntax

brc32 [options] <filename>.RC [<filename>.EXE]

Command-line options

BRC32 accepts these options:

Switch Description

-d<name>[=string] Defines a symbol you can test with the #IFDEF
preprocessor directive.
-fo<filename> Renames the .RES file.
-fe<filename> Renames the .EXE file.
-i<path> Adds one or more directories (separated by semicolons) to the
include search path.
-r Creates a .RES file only. The compiled .RES file is not added to the
.EXE.
-v Prints progress messages (verbose listing).
-x Directs the compiler to ignore the INCLUDE environment variable when it
searches for include or resource files.

-16 Builds 16-bit .RES files.
-32 Builds 32-bit .RES files.
-Vd.d Makes the .EXE file with Windows version provided (v3.1 is the
default for 16-bit resources; -v4.0 is the default for 32-bit resources).
Version options are listed in the following table.

Option Bit Resulting look

3.1 16 Gives white background with a non 3-D look for Windows 3.1x,
Windows 32s, or WinNT 3.1
4.0 16 Gives gray 3-D look for Windows 95 and WinNT 3.51
3.1 32 Gives white background with a non 3-D look for Windows 32s or WinNT
3.1
4.0 32 Gives gray 3-D look for Windows 95 and WinNT 3.51

The following switches are invalid when the -r switch is specified:

-k Disables the contiguous preload of segments and resources in the .EXE
file. Segments are kept in the order in which they appear in the .DEF file.
(This option only applies to 16-bit resources.)
-t Creates an application that runs only in protected mode (Windows
Standard or 386 Enhanced mode).

Downward compatibility

The following syntax and options are supported for downward compatibility

Syntax

brc32 [switches] <filename>.RC [<filename>.EXE]

Command-line options

BRC32 accepts these options:

Option Description

-31 Builds Windows 3.1-compatible .RES files.
-w32 Builds Win32-compatible .RES files.

-----------------

Resource shell examples

See also

The following statement compiles the .RC file, creates a .RES file, and
adds the .RES file to the executable file:

brc32 <filename>.RC [<filename>.EXE]

BRC32 automatically seeks an .EXE file with the same name as the .RC file.
You need to specify the .EXE file only if its name is different from that
of the .RC file.

The following statement creates a .RES file, but not an .EXE file. If you
name an .EXE file in the command line, BRC ignores it:

brc32 -r <filename>.RC

The following statement adds an existing .RES file to an executable file.
The .EXE file name is required only if it differs from the .RES file name:

brc32 <filename>.RES [<filename>.EXE]

This example uses BRC32 to build a 16-bit Windows 3.1 compatible .RES file:

brc32 -16 -v3.1 -fo<filename>.RES <filename>.RC

Borland Resource Compiler BRC32.exe

Syntax: brc32 [options ...] filename
  options marked with a '*' are on by default

  -r                    compile only. Do not bind resources
  -fofilename           set output res filename
  -fefilename           set output exe filename
  -v                    verbose
  -ipath                set include path
  -x                    ignore INCLUDE environment variable
  -dname[=string]       define #define
  -32                *  build 32-bit Windows compatible res/exe files
  -16                   build 16-bit Windows compatible res/exe files
  -Vd.d Mark the .exe file with Windows version provided (4.0 is the default)
  -31  Provided for downward compatibility (build 16-bit res/exe files)
  -w32 Provided for downward compatibility (build 32-bit res/exe files)
  -k                    do not create fastload area (16 bit only)
  -t                    (ignored, for compatibility)
  -? or -h              display this message

Borland Resource Compiler BRCC32.exe

Borland Resource Compiler  Version 5.40
Copyright (c) 1990, 1999 Inprise Corporation.  All rights reserved.

Syntax: brcc32 [options ...] filename
  options marked with a '*' are on by default

  @        Take instructions from command file
  -r                    (ignored for compatibility)
  -16                   Build 16-bit Windows compatible .res file
  -32                 * Build 32-bit Windows compatible .res file
  -fofilename           Set output filename
  -v                    Verbose
  -ipath                Set include path
  -dname[=string]       Define #define
  -x                    Ignore INCLUDE environment variable
  -m                    Enable multi-byte character support
  -cdddd                set default code page to nnnn
  -lxxxx                set default language to xxxx
  -31   Provided for downward compatibility (build 16-bit .res file)
  -w32  Provided for downward compatibility (build 16-bit .res file)
  -? or -h              Display this message


GoRC Resource compiler Manual

Vu dans ... http://www.GoDevTool.com

GoRC
Resource Compiler Manual

Version 1.0.0.0

Introduction
Starting the Resource Compiler
Directives (eg. #define, #if, #include)
Other Symbols
Numbers
Arithmetic
Strings and String Manipulation
Windows Character Set
Raw Data Resources (eg. cursor, bitmap, RCDATA etc)
STRINGTABLE Resource
VERSIONINFO Resource
ACCELERATORS Resource
MENU Resource
DIALOG Resource
VERSION and CHARACTERISTICS
LANGUAGE
Capitalisation of nameIDs and types
Legal Stuff

Introduction

This document assumes that the reader has some knowledge of resources, what they are and how they work.

This document is intended for use with the GoRC resource compiler. There are some slight differences in the permitted syntax between the Microsoft Resource compiler and GoRC. In general GoRC will accept all RC source files that the Microsoft Resource compiler will accept but is slightly more flexible in its syntax.

RC source files (those with an ".rc" extension) should be text without formatting codes, other than carriage return, linefeed or tabs, such as produced by most simple text editors. More sophisticated word processors can also produce such files if they are instructed to produce TXT files, ASCII or ANSI files.

The resource script and include files can be in Unicode format. If so, GoRC expects a Byte Order Mark (BOM). GoRC can read the UTF-8 Unicode format with BOM, or the UTF-16LE Unicode format with BOM.

GoRC can make two types of binary resource files from a resource script. It can make an OBJ file in COFF format, which is suitable for linking with other OBJ files to produce the final EXE or DLL. It can also produce a RES file, which is an intermediate file in binary format. GoRC can also convert a RES file to an OBJ file.

The OBJ file made by GoRC can either be in Win32 format (the default) or Win64 format if you specify the /machine AMD64 or /machine X64 switch in the command line.

Here are the syntax rules which are used in this reference:-

  • Normal text shows words as they actually appear in your source code.
  • Italic text describes only the type of entry in your source code- look for the description to see what can be put there.
  • [Text in square brackets means that the material is optional].

Starting the Resource Compiler

The command line syntax is:-

GoRC [command line switches] filename[.ext]

Where,

command line switches		can be one or more of the following:-
                            /h or /?			help
                            /d				define a word
                            /o				create OBJ file
                            /r				create RES file
                            /fo				specify output file
                            /machine AMD64	or
                            /machine X64		object output file will be in 64-bit format
                            /ni				no information messages
                            /ne				no error messages
                            /nw				no warning messages
                            /no				no output messages at all

filename					is the name of the resource script

ext						is the extension of the filename of the resource script

Input and Output files
The default action of GoRC is RC > RES and OBJ.
If no extension is given in the command line and GoRC cannot find filename.RC then it looks for filename.RES. If found, this results in the action RES > OBJ.

The default action can be overridden to achieve RC > RES in the following ways:-

  • Specifying a RES output file using the /r switch
  • Using the /fo switch and giving a filename with the RES extension

The default action can be overridden to achieve RC > OBJ in the following ways:-

  • Specifying an OBJ output file using the /o switch
  • Using the /fo switch and giving a filename with the OBJ extension

You can ensure the action is RES > OBJ by giving the input file with the extension RES.

By default, the output filenames will be the same as those of the input file, but you can use the /fo switch to change this. This is used as follows:-

  • use /fo filename to make the output files filename.OBJ and filename.RES
  • use /fo filename.OBJ to make the output file filename.OBJ; the RES output file will have the same name as the input file
  • use /fo filename.RES to make the output file filename.RES; the OBJ output file will have the same name as the input file
  • use /fo filename1.RES, filename2.OBJ to make output files matching the specified filenames; here two filenames are separated by a comma

By default, the output files will be placed in the same directory as the input file. You can specify a full path for the output files when using the /fo switch. You can enclose the filenames in quotes to permit the use of filenames with spaces and other unusual characters.

GoRC can work with Unicode input and output filenames, but the extensions used must be as set out above.

Errors and Warnings
Errors will cause the Resource Compiler to stop and no output files will be made. The console then shows the nature of the error and where it occurred. (unless the command line switch /ne has been specified). The Resource Compiler will also return with a code of 1, which will be likely to halt the build process if you are using a make file.

Warnings do not stop the Resource Compiler. A warning will be given (unless the command line switch /nw has been specified) if:-

  • An expression could not be evaluated when expecting an identifier. In this instance the Resource Compiler treats the expression as being an ID with a name. However this may not be your intention, if, for example you thought you had provided a #define directive for the expression.
  • An expression could not be evaluated when expecting a resource type. In this instance the Resource Compiler treats the expression as defining a resource, that is, a user-defined resource. Again this may not be your intention, so a warning is given.
  • No resources are found in the resource file. In this case no output file is made.

A warning will also be given if an expression has been defined more than once in the command line, resource script or in a non ".h" include file. This is because it would be unusual to define an expression more than once and it may be that this is a programming error. It is perfectly permissible to cancel a previous definition using #undef so that the expression can be redefined. In that case no warning is given. Also, because the Resource Compiler does not always need to look into ".h" files to evaluate an expression, and because it is presumed that such ".h" files ought to be free of such errors, no check of previous definitions in header files is carried out.

Directives

Directives are words in the resource script which give instructions to the Resource Compiler.

There are 3 types of directives:-

  • Defining directives
  • Include directive
  • Conditional directives

The Defining Directives

Evaluating types

These are #define macros which evaluate to a number or to a quoted string:-

#define name value

From this point when name is encountered in the resource script it is replaced by value.

Examples
#define IDC_BUTTON 0x20
#define DLGCONTROL 0x20 | 0x40
#define DLGTEXT "Hello world"
#define OTHER DLGCONTROL + IDC_BUTTON
#define WINNT
(this sets the name WINNT to a value of 1, that is, TRUE)

The RC compiler automatically defines RC_INVOKED, so that you can use the conditional directives to skip over unwanted resource script text.

Example
#ifndef RC_INVOKED
skipped text
#endif

You can define a name from the command line:-

Examples
GoRC /d WINVER=400h mainres
This compiles the resource script mainres, on the basis that WINVER is equal to hex 400 throughout.

GoRC /d WINNT mainres
This compiles the resource script mainres, on the basis that WINNT has a value of 1 (that is, TRUE).

GoRC /d WINNT=55h /d good=0x44 mainres
Example of more than one definition.

GoRC /d WINNT=330, good=0x44 mainres
Example of more than one definition using comma.

To remove the value for a definition and have name undefined, use #undef:

#undef name

From this point in the resource script any earlier value for the name given by a #define is no longer used.

Examples
#undef IDC_BUTTON
#undef DLGCONTROL

Non evaluating types

These are #define macros which do not evaluate to a single result:-

#define name value1 value2 value3

From this point when name is encountered in the resource script it is replaced by value1 value2 value3.

Example
#define GRASSHOPPER Deep Influences On Us
#define FILENAME README
#define EXTENSION TXT
FILENAME.EXTENSION (becomes README.TXT)

Macros with arguments

These are #define macros which use the arguments supplied when the macro is used.

Syntax for the macro in which the arguments are declared:-

#define  name(arg1,arg2,arg3,...)   use of arguments

Syntax to supply the arguments:-

name(arg1,arg2,arg3,...)

Examples
#define NIM($a,$b) $a+$b
NIM(23,45)
(result is 68)

#define NIMROD($a,$b) #$a
NIMROD (HANG,OVER)
(result is "HANG")

Note that the number of arguments which are supplied must exactly match the number of arguments declared, but they need not all be used. When an argument is declared there must be no space between the macro name and the arguments, but there can be spaces when the argument is supplied or used.

The Include Directive

The #include directive will cause the Resource Compiler to load and look at the specified file:-

#include path\filename

Where,

path\filename	can be either:-
                a quoted string
                a non-quoted string
                a string in less-than and greater-than characters

The Resource Compiler will look for the file using the path specified. If no path is specified it will look in the current directory. If the file is not found it will look for it in the path given by the INCLUDE environment string. You can set the INCLUDE environment string using the SET command in the MSDOS window, or by calling the SetEnvironmentVariable API. You can also use control panel, system, advanced, environment if your operating system will permit this, followed by a reboot. Note: there may be a different environment string for each folder or sub-folder. Ensure the environment string you wish to use is in the current directory.

To the Resource Compiler there are two types of #include files:-

  • There are "header" files, with the file extension ".h". These files are not treated as part of the resource script, but are regarded only as containing defining directives. This enables the Resource Compiler to work more quickly because it will not bother to search an ".h" file unless it has an expression which it is trying to evaluate. Any ordinary resource script statements in an ".h" file will be ignored by the Resource Compiler.

    Note that the Resource Compiler is itself aware of most if not all of the usual styles and expressions used in a resource script. For this reason it will not normally be necessary to include any header files. However you will need to define your own expressions and identifiers if you wish to use those.

  • The second type of #include files are non ".h" files. These are treated as part of the resource script itself by the Resource Compiler. When an #include directive if found for a non ".h" file, the Resource Compiler will divert its attention to the #include file and when it has finished looking at that file it will return to the original script where it left off.

You can nest #include files but it is probably good practice to avoid this as far as possible.

Definition Priority

A #define directive in an ".h" include file is regarded as of lower priority than a #define directive in the command line, resource script or in a non ".h" include file. Therefore if there is any conflict between the #defines, the #define in the ".h" include file will be ignored.

The Conditional Directives

With these directives you can select at compile-time that part of the resource script or of the defining directives which you want to be compiled. This may be useful if, for example, you want to make different versions of your program from the same resource script.

The syntax of the basic structure of a conditional directive in its simplest form is as follows:-

#if condition
    text A
#endif

Here if the condition is TRUE text A will be compiled. If, however, the condition is FALSE, the compiler will jump over text A and will continue compiling from the #endif.

You can add something to do if the condition is FALSE as follows:-

#if condition
    text A
#else
    text B
#endif

Here if the condition is TRUE, text A will be compiled, but text B will not be compiled. If, however, the condition is FALSE, text A will be jumped over but text B will be compiled.

The #endif indicates the end of the conditional frame, so that all text after that will be compiled.

The #else statement must always be next before the #endif.

You can add a further condition to the frame:-

#if condition1
    text A
#elif condition2
    text B
#endif

Here if condition1 is TRUE, text A will be compiled, but text B will be jumped over and compilation will continue from the #endif. If, however, condition1 is FALSE, text A will be jumped over to the #elif when condition2 will be tested. If then condition2 is TRUE, text B will be compiled. "#elif" is the same as "#elseif".

Adding the #else to the above conditional frame produces:-

#if condition1
    text A
#elif condition2
    text B
#else
    text C
#endif

Here if condition1 is TRUE, text A will be compiled, but text B and text C will be jumped over and compilation will continue from the #endif. If, however, condition1 is FALSE, text A will be jumped over to the #elif when condition2 will be tested. If then condition2 is TRUE, text B will be compiled, and text C will be ignored; if, however condition2 is FALSE text B will be jumped over to the #else and text C will be compiled.

You can have as many #elifs as you like in each conditional frame, but there can only be one #else per frame, and each #if must have a corresponding #endif. Some programmers nest the conditional frames, but this can become very confusing and may not be good programming practice. If this is done it is recommended that you label each #endif with a comment so that you can see to which #if it refers.

Types of #if statements

#ifdef expression		where expression is a word which may be defined in the resource script
                    or in a header file. This statement returns TRUE if the expression is defined
                    and FALSE if it is not defined. The expression must be a word and not a
                    number nor a quoted string.

#ifndef expression		as above but this statement returns FALSE if the expression is defined and
                    TRUE if it is not defined.

#if  0					this statement always returns FALSE and so it can be used to jump over
                    text which ought to be ignored.

#if expression1  relational-operator  expression2

                    where,

                    expression1 must be a word which is defined elsewhere in the file,
                    in an include file or on the command line. It cannot be a number.

                    relational operator can be one of the following:-
                        >=	greater than or equals
                        <=	less than or equals
                        ==	equals
                        =	equals
                        !=	not equal
                        >	greater than
                        <	less than

                    expression2 can be a number or a word which is defined elsewhere in
                    the file, in an include file or on the command line, which evaluates to a
                    number. For example, #if WINVER>=400h will return TRUE if WINVER
                    is defined as 400h or more.

#if ! expression		this reverses the result of the condition, so #if is not the same as #if !.
                    For example, #if!0 would return TRUE.

Other Symbols

These are some other symbols which may be used in the resource script or a header file and which have a special meaning to the Resource Compiler.

;		single line comment - everything after this to the end of the line is ignored

//		single line comment - everything after this to the end of the line is ignored

;;  ...		block comment - can span several lines and everything between the leading
     ...  ;;	and trailing marks is ignored

/*  ...		block comment - can span several lines and everything between the leading
     ...  */	and trailing marks is ignored

\		line continuation - at the end of a line or just before a comment, allows processing to
        continue with the material on the next line (cannot be used in quoted strings or filenames)

{		same as BEGIN

}		same as END

-number	means the number is negative (eg. -22h if a dword becomes 0FFFFFFDEh)

~number	means the number is inverted (eg. ~22h if a dword becomes 0FFFFFFDDh)

+		plus for addition (eg. 22h + 3h produces 25h)

-		minus for subtraction (eg. 22h - 3h produces 1Fh)

| or ¦		bitwise OR (eg. 22h | 3h produces 23h)

&		bitwise AND (eg. 22h & 3h produces 2h)

!value	in arithmetic, this causes the value to be inverted and
        then ANDed with the existing, and is the same as minus value

NOT value	same as above

#		in a #define macro, this causes quotes to be added to what follows
        eg. #HELLO becomes "HELLO"
        eg. #(MAJOR.MINOR) becomes "MAJOR.MINOR"

##		in a #define macro, this joins two elements, removing all spaces in between
        eg. PATCH ## WORK becomes PATCHWORK

(...)		in a #define macro, the material within the parentheses is evaluated first

Numbers

The Resource Compiler recognises the following types of numbers, for example:-

6666666h	a hex number
3434343H	a hex number
9999999D	a decimal number
22553388d	a decimal number
34567789	a decimal number
0x456789		a hex number
456L		specifies the number is to be recorded as a dword
            where otherwise it would be a word

Arithmetic

The resource compiler can perform limited arithmetic on the following:-

  • identifiers, styles, flags and dialog and control positions and dimensions
  • defining directives
  • expressions in conditional directives
Examples of arithmetic
66h+2h CURSOR first.cur
#define BELLS 200h | 22h + 1h
BELLS+1000h ICON icon1.ico
BELLS-1h ICON icon1.ico
STYLE WS_TABSTOP | WS_GROUP | WS_DISABLED
DIALOG 0x34+2,0x20,0x300-0x60,400-200

The Resource Compiler cannot resolve more complex formulae involving for example logical operators, decimal points, multiplication or division.

Strings and String Manipulation

Quoted strings in the stringtable resource and in all text for dialogs and menus must be kept in the binary resource files and in the EXE in Unicode. If the resource script is an ANSI text file, however, the strings will be in ANSI characters. In that case the Resource Compiler converts them to Unicode using the API MultiByteToWideChar. This API uses the current codepage for this conversion, so you need to ensure that at compile time your machine is set to use the same codepage as was used when the source script was made.

If the resource script is a Unicode file, then codepages are not used; the strings are used as they appear in the resource script.

The strings are put in the RES file (or OBJ file) in Unicode whether or not you use the "C" style Unicode indicator L"string". The Resource Compiler regards the L"string" indicator as implicit for these types of strings. So there is no need to use that indicator in your resource script (unless you want to insert special Unicode characters - see below).

There is no implicit L"string" indicator for quoted strings in the raw data resources (eg. RCDATA). Therefore in an ANSI file such strings are not converted to Unicode unless L"string" is specified.

All quoted strings may contain escape sequences which are dealt with in a special way by the Resource Compiler:-

&		in menu title strings this causes the system at run-time to create an
        accelerator for the menu item using the character following the ampersand.
        If you need an ampersand include it twice eg. &&

" "" "		double-up the quotation marks to retain them. For example
        """Hello there""" will be kept as "Hello there" and
        "He said ""Hello there"" quickly" will be kept as He said "Hello there" quickly

""		an empty string (useful for example in static controls
        where the text is to be inserted during run-time later)

\t		tab (converted to the 9h TAB character)

\a		alert (converted to the 8h BELL character)
        in menus this is used to align all the following text to the right

\n		new line (converted to the 0Ah LINEFEED character)

\r		return (converted to the 0Dh CARRIAGE RETURN character)

\\		converted to one backslash only

\number	see below

\other	the backslash is regarded as an ordinary backslash

\number to produce a special character

In all quoted strings which are converted by the Resource Compiler you can have:-

\number

This then will cause the character represented by number to be inserted in the text. For example, "Copyright \251 2005" inserts a © symbol in the text. Strange! The © symbol, as everybody knows, is ANSI value 169, or A9 in hex.

However, the Resource Compiler uses octal numbers in this feature rather than decimal, ie. all digits are to base 8. Why? This is simply to provide compatibility with existing resource scripts.

Sometimes \number can look rather odd. For example "The entrance fee was \4423", is converted to "The entrance fee was $23". Here the Resource Compiler does not try to find character 442 octal or 4423 octal because it knows that this value is too high. This works fine for characters above 38 octal, but for characters with values less than this, for example 12 octal which is the value 0Ah (linefeed) there could be confusion, for example "We found on average about\1223 flies in each of the soups". This should be written "We found on average about\01223 flies in each of the soups". This is because the Resource Compiler will only look at 3 octal digits and no more, so it stops after the \012 (linefeed), and the value 23 is kept in the text properly. Of course you could use \n instead to ensure there is no chance of confusion and this would be better.

\number in hex rather than in octal

You can also use hex values when entering \number, by including x after the backslash. For example the hex version "Copyright \xA9 2005" is the same as "Copyright \251 2005" which is the octal version. Again the Resource Compiler will not look beyond the second hex digit for the value, so ensure that where small values are used you insert the zero if there is any danger of confusion. For example in "The capacitor had a value of 3\xb5farads" the Resource Compiler does not take the hex number b5f, but looks only at b5 hex. However, in the string "It returned to Earth\x0aafter 44 years with 5 more people on board", the zero is required to avoid using the hex number aa as the special character.

\number in Unicode strings

The Resource Compiler looks at up to four hex digits in \number if the string is expressly declared to be a Unicode string. You can do this by using the "C"-style indicator L"string" for the string. So, for example to create a string for a dialog button which displays a Shekel you would use the following string:-

L"\x20AA"

This creates the Unicode special character 20AAh (the Shekel sign).

You would not need to do this if you used Unicode format files, since you could display the Shekel normally and it would be coded properly by the Resource Compiler.

The Windows Character Set

The character set used when the string is written to the screen by the menu, dialog or other method, depends on which character set is in use in the computer running the EXE. For computers used in English this is usually the Windows Character Set. A table of octal values may be difficult to find so one is provided as follows for your use, along with another table afterwards with the hex values.

The Windows Character Set and octal values

Space | ! | " | # | $ | % | & | ' | ( | ) | * | + | , | -
40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 50 | 51 | 52 | 53 | 54 | 55
. | / | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | : | ;
56 | 57 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 70 | 71 | 72 | 73
< | = | > | ? | @ | A | B | C | D | E | F | G | H | I
74 | 75 | 76 | 77 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 110 | 111
J | K | L | M | N | O | P | Q | R | S | T | U | V | W
112 | 113 | 114 | 115 | 116 | 117 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127
X | Y | Z | [ | \ | ] | ^ | _ | ` | a | b | c | d | e
130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 140 | 141 | 142 | 143 | 144 | 145
f | g | h | i | j | k | l | m | n | o | p | q | r | s
146 | 147 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 160 | 161 | 162 | 163
t | u | v | w | x | y | z | { | | | } | ~ |  |  |
164 | 165 | 166 | 167 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 200 | 201
‚ | ƒ | „ | … | † | ‡ | ˆ | ‰ | Š | ‹ | Œ |  |  |
202 | 203 | 204 | 205 | 206 | 207 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217
 | ‘ | ’ | “ | ” | • | – | — | ˜ | ™ | š | › | œ |
220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 230 | 231 | 232 | 233 | 234 | 235
 | Ÿ |  | ¡ | ¢ | £ | ¤ | ¥ | ¦ | § | ¨ | © | ª | «
236 | 237 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 250 | 251 | 252 | 253
¬ |  | ® | ¯ | ° | ± | ² | ³ | ´ | µ | ¶ | · | ¸ | ¹
254 | 255 | 256 | 257 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 270 | 271
º | » | ¼ | ½ | ¾ | ¿ | À | Á | Â | Ã | Ä | Å | Æ | Ç
272 | 273 | 274 | 275 | 276 | 277 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307
È | É | Ê | Ë | Ì | Í | Î | Ï | Ð | Ñ | Ò | Ó | Ô | Õ
310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 320 | 321 | 322 | 323 | 324 | 325
Ö | × | Ø | Ù | Ú | Û | Ü | Ý | Þ | ß | à | á | â | ã
326 | 327 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 340 | 341 | 342 | 343
ä | å | æ | ç | è | é | ê | ë | ì | í | î | ï | ð | ñ
344 | 345 | 346 | 347 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 360 | 361
ò | ó | ô | õ | ö | ÷ | ø | ù | ú | û | ü | ý | þ | ÿ
362 | 363 | 364 | 365 | 366 | 367 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377

The Windows Character Set and hex values

Space | ! | " | # | $ | % | & | ' | ( | ) | * | + | , | -
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 2A | 2B | 2C | 2D
. | / | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | : | ;
2E | 2F | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 3A | 3B
< | = | > | ? | @ | A | B | C | D | E | F | G | H | I
3C | 3D | 3E | 3F | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49
J | K | L | M | N | O | P | Q | R | S | T | U | V | W
4A | 4B | 4C | 4D | 4E | 4F | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57
X | Y | Z | [ | \ | ] | ^ | _ | ` | a | b | c | d | e
58 | 59 | 5A | 5B | 5C | 5D | 5E | 5F | 60 | 61 | 62 | 63 | 64 | 65
f | g | h | i | j | k | l | m | n | o | p | q | r | s
66 | 67 | 68 | 69 | 6A | 6B | 6C | 6D | 6E | 6F | 70 | 71 | 72 | 73
t | u | v | w | x | y | z | { | | | } | ~ |  |  |
74 | 75 | 76 | 77 | 78 | 79 | 7A | 7B | 7C | 7D | 7E | 7F | 80 | 81
‚ | ƒ | „ | … | † | ‡ | ˆ | ‰ | Š | ‹ | Œ |  |  |
82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 8A | 8B | 8C | 8D | 8E | 8F
 | ‘ | ’ | “ | ” | • | – | — | ˜ | ™ | š | › | œ |
90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 9A | 9B | 9C | 9D
 | Ÿ |  | ¡ | ¢ | £ | ¤ | ¥ | ¦ | § | ¨ | © | ª | «
9E | 9F | A0 | A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | AA | AB
¬ |  | ® | ¯ | ° | ± | ² | ³ | ´ | µ | ¶ | · | ¸ | ¹
AC | AD | AE | AF | B0 | B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B9
º | » | ¼ | ½ | ¾ | ¿ | À | Á | Â | Ã | Ä | Å | Æ | Ç
BA | BB | BC | BD | BE | BF | C0 | C1 | C2 | C3 | C4 | C5 | C6 | C7
È | É | Ê | Ë | Ì | Í | Î | Ï | Ð | Ñ | Ò | Ó | Ô | Õ
C8 | C9 | CA | CB | CC | CD | CE | CF | D0 | D1 | D2 | D3 | D4 | D5
Ö | × | Ø | Ù | Ú | Û | Ü | Ý | Þ | ß | à | á | â | ã
D6 | D7 | D8 | D9 | DA | DB | DC | DD | DE | DF | E0 | E1 | E2 | E3
ä | å | æ | ç | è | é | ê | ë | ì | í | î | ï | ð | ñ
E4 | E5 | E6 | E7 | E8 | E9 | EA | EB | EC | ED | EE | EF | F0 | F1
ò | ó | ô | õ | ö | ÷ | ø | ù | ú | û | ü | ý | þ | ÿ
F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | FA | FB | FC | FD | FE | FF

Resource Statements

Resource statements are the instructions to the Resource Compiler which contain the information from which the output file is actually made. They fall into four main categories:-

  • Raw data resource types taking data from (a) a file (b) the resource script
  • The stringtable resource
  • The information resource types
  • Resources for the user-interface

Raw data resource types (a) taking data from a file

With these resources the Resource Compiler merely takes raw data from an input file and adds it to the output file (sometimes with some extra processing). Hence the data from these files makes its way to the EXE, when the file is linked, for use during run-time. This is a convenient way to keep the data from such files in the EXE. An alternative would be to ship the individual files with the product for loading at run-time, but this runs the risk that those files may get lost.

The data (as raw data) can be used at run-time by calling the FindResource and LoadResource APIs, but there are some specific APIs which also provide manipulation of the data. The various raw data resource types which work using files, their resource type numbers, and the specific API (if any) to load them during run-time are:-

CURSOR			1	LoadCursor or LoadImage
BITMAP			2	LoadBitmap or LoadImage
ICON			3	LoadIcon or LoadImage
FONT			8	no longer in use
RCDATA			10
MESSAGETABLE	11	FormatMessage
PLUGPLAY		19
VXD				20
ANICURSOR		21
ANIICON			22
HTML			23
MANIFEST		24
User-defined resource

The User defined resource is a resource holding raw data only, which is of the type defined by the user. It can be defined by name, for example, MyRes, or by number, which can be any 16-bit number above 0FFh. The numbers 1 to 0FFh are reserved for the system defined resources.

The general syntax for these resource types in the resource script (using CURSOR as an example) is:-

nameID CURSOR filename

Where,

nameID	can be either:-
            a 16-bit number of value 1 to 7FFFh
            an expression which evaluates to that number
            a name (except for FONT, a FONT resource cannot be identified by name)
filename	can be either:-
            a quoted string
            a non-quoted string
            a string in less-than and greater-than characters

            Unless the file is in the current directory, the full path should be given.
Examples
2 CURSOR happy.cur
0x6666 BITMAP c:\bitmaps\happy.bmp
MyIcon ICON "happy.ico"
#define ID_MINE 22
ID_MINE ICON <happier.ico>
44h RCDATA happy.txt
ID_MINE RCDATA happier.txt
1 MANIFEST "YourApp.manifest"
788h MYRES happier.txt			;(a user-defined resource)
MY_CAT WAVE sounds/cat.wav	;(a user-defined resource)
788h 100h happier.txt			;(a user-defined resource)

Raw data resource types (b) taking data from resource script

These resources allow you to insert raw data into the EXE via the binary resource file. The Resource Compiler makes no alteration to the raw data. Unless use is being made of the ability of the system to distinguish between resources of different languages, assembler programmers would probably not find much use for this as it is so simple to use the data segment to keep data..

The data (as raw data) can be used at run-time by calling the FindResource and LoadResource APIs.

This type of resource is RCDATA (type number 10) when used with BEGIN and END, and not with a filename. Alternatively you can choose any name for the resource in which case it works the same way as RCDATA except that the resource type has a name. This is called a user-defined resource. Alternatively you can also simply provide any 16-bit number above 0FFh for the resource type.

The syntax for RCDATA used in this way is:-

nameID RCDATA
[defining-statements]
BEGIN
    raw-data
END

Or, in the case of a user-defined resource:-

nameID type
[defining-statements]
BEGIN
    raw-data
END

Where,

nameID				can be either:-
                        a 16-bit number of value 1 to 7FFFh
                        an expression which evaluates to that number
                        a name

defining-statements		need not be present, but can be either:-
                        a VERSION statement
                        a CHARACTERISTICS statement
                        a LANGUAGE statement

                        see below for details

type					can be either:-
                        a 16-bit number greater than 0FFh
                        an expression which evaluates to a 16-bit number greater than 255
                        a name in characters

raw-data				can be either:-
                        an ANSI quoted string
                        a Unicode quoted string starting with L"
                        a numerical value stored as a word
                        a numerical value stored as a dword (ending in L)
Examples
0x3333 RCDATA
BEGIN
    "Hello world"
    "Hello world (zero terminated)\0"
    L"A Unicode version of the above\0"
    0x9999  ;hex number stored as a word
END

MyRes RCDATA
BEGIN
    1034	;decimal number stored as a word
END

MyRes MyResType
BEGIN
    10456L	;decimal number stored as a dword
    1234L,56666L,99999L	;decimal numbers stored as dwords
END

34h 100h
BEGIN
    33hL,34hL,35hL,36hL		;hex numbers stored as dwords
    0x37L,0x38L,0x39L,0x40L	;C-style hex numbers stored as dwords
END

The STRINGTABLE Resource

The STRINGTABLE resource enables strings to be kept in the EXE to be recovered when needed at run time. For assembler programmers this would be an alternative to keeping the strings in the data segment. Even if you need to use Unicode strings, if you are using GoAsm as your assembler it is usually easier to keep the strings in data rather than to use the STRINGTABLE resource.

If the source file is in ANSI format, strings in the STRINGTABLE resource are automatically converted to Unicode by the Resource Compiler, so there is no need to use the "C" style Unicode indicator L"string". The Resource Compiler regards the L"string" indicator as implicit. The conversion is carried out using the API MultiByteToWideChar. This API uses the current codepage for this conversion, so you need to ensure that at compile time your machine is set to use the same codepage as was used when the source script was made.

If the source file is in Unicode format, then no conversion takes place and codepages are not used; the strings are used as they appear in the resource script.

One reason why the assembler programmer might wish to keep strings in a STRINGTABLE resource rather than in the data segment would be to take advantage of the ability of the system to distinguish strings of different languages at run-time.

The strings are kept in blocks of 16 strings. Each block will have the same language and also the same upper 12 bits of the ID which was specified in the resource script. The least significant 4 bits are blanked out and are not be recorded because it is assumed that the IDs run in sequence in each block from 0 to 0Fh. To make this assumption valid, if the string IDs are not in sequence the Resource Compiler has to insert empty strings. To reduce space requirements, therefore, it is best to keep the identifiers sequential.

To recover one of the strings, call LoadString giving the string identifier. It will then be copied into a buffer with a nul terminator.

The syntax for the STRINGTABLE resource is as follows:-

STRINGTABLE
[defining-statements]
BEGIN
stringID "string"
.........
END

Where,

stringID	can be either:-
            a 16-bit number which identifies the string
            an expression which resolves to that number
"string"	can be either:-
            a quoted string of not more than 4097 characters
            an expression which is defined elsewhere as a string

If the string straddles more than one line the Resource Compiler inserts a space and a line feed character (ASCII 0Ah) at the line break and all leading spaces on the next line in your resource script are suppressed.

Information resource types

These types of resources are used to keep information about the EXE in a certain format, for use by tools or for information to the user.

There are two types of such resources.

Firstly DLGINCLUDE (resource type17) which contains a filename which is read by the Microsoft Dialog Editor. This filename is that of the include file containing definitions when making dialogs. This information is not actually kept in the EXE, and is disgarded by the linker.

Its syntax is:-

nameID DLGINCLUDE filename

Where,

nameID	can be either:-
            a 16-bit number of value 1 to 7FFFh
            an expression which evaluates to that number
            a name
filename	can be either:-
            a quoted string
            a non-quoted string
            a string in less-than and greater-than characters
            unless the file is in the current directory, the full
            path should be given

The VERSIONINFO Resource

Secondly, the VERSIONINFO resource (resource type 16), which is used to keep information about the version of the EXE and may be required during its installation or if it is updated.

The version information can be retrieved in various ways using the APIs GetFileVersionInfo, GetFileVersionInfoSize, and VerQueryValue. Also it is the information which appears in the "Version" property sheet when looking at the "Properties" of an Executable file in Windows.

The syntax for this resource is:-

1 VERSIONINFO
[fixed-info statements]
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK lang-charset
        BEGIN
            string-value statements
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation"
        lang/char statements
    END
END

Where,

fixed-info statements	can be one or more of the following statements with data as in the following
                    examples. The data is used by the Resource Compiler to fill a structure of
                    13 dwords which is kept in the binary resource file and therefore in the EXE
                    file (the VS_FIXEDFILEINFO structure)

FILEVERSION 3h,0Ah,0,3Dh
                    this value needs to be written as four 16-bit values which
                    are in fact recorded as two dwords: in this example the first dword
                    (most significant) is 3000Ah and the second dword (least significant)
                    is 3Dh, producing a version value of 3000A 0000003Dh.

PRODUCTVERSION 6666h,0000h,0000h,7777h
                    defines a product version of 66660000 00007777h

FILEFLAGSMASK 3Fh	specifies which bits in the next parameter are valid

FILEFLAGS fileflags	which can be one or more of the following flags or values:-

VS_FF_DEBUG		(1= the file contains debugging information)
VS_FF_PATCHED		(4= the version information has been changed from the
                    original shipping version)
VS_FF_PRERELEASE	(2= the file is a development version only and is not
                    commercially available)
VS_FF_PRIVATEBUILD	(8= the file was not built using standard release procedures)
VS_FF_SPECIALBUILD	(20h= the file was built using standard release procedures but
                    is a variation of the standard file of the same version number)

FILEOS fileos			where fileos specifies the operating system for which the file
                    was designed and can be one of the following values:-

VOS_UNKNOWN		(value zero - unknown)
VOS_DOS			(1000h= file designed for DOS)
VOS_NT				(4000h= file designed for Windows NT)
VOS__WINDOWS32	(4= file designed for 32-bit Windows)
VOS_NT_WINDOWS32	(40004h= file designed for 32-bit Windows running
                    under Windows NT)

FILETYPE filetype		where filetype specifies the general type of
                    the file and can be one of the following values:-

VFT_UNKNOWN		(value zero=unknown)
VFT_APP			(1= it’s an application)
VFT_DLL				(2= it’s a DLL)
VFT_DRV			(3= it’s a device driver)
VFT_FONT			(4= it’s a font)
VFT_VXD			(5= it’s a virtual device)
VFT_STATIC_LIB		(7= it’s a static link library)

FILESUBTYPE subtype		where subtype specifies more information about the type of file,
                        and if filetype is VFT_DRV can be one of the following values:-

VFT2_UNKNOWN 		(value zero -unknown)
VFT2_PRINTER		(1= it’s a printer driver)
VFT2_KEYBOARD		(2= it’s a keyboard driver)
VFT2_LANGUAGE		(3= it’s a language driver)
VFT2_DISPLAY		(4= it’s a display driver)
VFT2_MOUSE		(5= it’s a mouse driver)
VFT2_NETWORK		(6= it’s a network driver)
VFT2_SYSTEM		(7= it’s a system driver)
VFT2_DRV_INSTALLABLE	(8= it’s an installable driver)
VFT2_DRV_SOUND	(9= it’s a sound driver)
VFT2_DRV_COMM		(0Ah= it’s a communications driver)

                    if filetype is VFT_FONT it can be one of the following values:-

VFT2_FONT_RASTER		(1= a raster font)
VFT2_FONT_VECTOR		(2= a vector font)
VFT2_FONT_TRUETYPE	(3= a TrueType font)

                    if filetype is VFT_VXD this value must be the virtual-device
                    identifier included in the virtual-device control block

                    The names of the fixed-info statements are fixed and are used by the
                    Resource Compiler to decide where in the VS_FIXEDFILEINFO structure
                    to put the specified value. As you can see, certain values have definite
                    meanings reserved by Microsoft, but there seems to be no reason why
                    you cannot use your own values which may have a special meaning to
                    your application.

lang-charset			is a quoted string containing (in numbers) a hex number which gives
                    the language and character set used in the string-value statements
                    which follow. The most common value found here is "040904E4" meaning
                    US English + Windows, multilingual character set.

                    lang/char statements are two 16-bit numbers separated by a comma.
                    The first represents a language and the second a character set supported
                    by the application. If a lang/char statement is included in the VERSIONINFO
                    resource, the system will initialise the "Version" property sheet found
                    when looking at the "Properties" of the executable file, and will include
                    a "Language" key. The most common value found is 0x409,1252 which is
                    US English + Windows, multilingual character set, with the latter being
                    given in its decimal value, but 4E4h would do just as well.

string-value statements	are a series of statements containing two quoted strings
                    with the following syntax:-

                    "name", "value"

        "name"		is a string which would be given to the
                    API VerQueryValue in order to retrieve the value.

                    The following strings are looked for by the system when showing
                    the "Version" property sheet:-

                    "FileVersion", "FileDescription" and "LegalCopyright",
                    and the value appears at the top of the property sheet adjacent
                    to the words "File Version", "Description" and "Copyright" respectively.

                    Other strings appear in listboxes in the property sheet. You can use
                    whatever string you like, although if they are too long they are truncated
                    in the property sheet and they always appear in alphabetical order.

                    You often see one of the following strings being used:-
                    "Comments" "CompanyName" "InternalName"
                    "LegalTradmarks" "OriginalFilename" "PrivateBuild"
                    "ProductName" "ProductVersion" "SpecialBuild"

        "value"		is a user defined value in a quoted string which corresponds to
                    one of the standard strings and will be returned by VerQueryValue.

Example of a VERSIONINFO resource
1  VERSIONINFO
FILEVERSION			2,0,0,0
PRODUCTVERSION	2,0,0,0
FILEFLAGSMASK	0x0000003FL
FILEFLAGS		0x0000000BL
FILEOS			0x00010001L
FILETYPE		0x00000001L
FILESUBTYPE	0x00000000L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904E4"
        BEGIN
            VALUE "CompanyName", "MySoftware Company"
            VALUE "Contact e-mail", "MySoftware@ether.com"
            VALUE "FileDescription","MySoftware.Exe"
            VALUE "FileVersion", "3.45"
            VALUE "DevelopmentFile","Dev345.asm"
            VALUE "LegalCopyright","Copyright\251 2005 Co"
            VALUE "Resources made using","GoRC.Exe"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x0409,1252
    END
END

Resources for the User-Interface

These types of resources make it easy to create accelerators, menus, and dialogs - three basic ingredients for the user interface. In each case it is possible to use the APIs instead of using the resource file, but this is normally much less convenient, and no advantage can be taken of the system being able automatically to discriminate between menus and dialogs of different languages.

In order to use these resources, in a single language application a specific API is called to obtain a handle to the resource.

The five resource types under this heading, the resource type numbers and the APIs used to use the resources are:-

ACCELERATORS	9	LoadAccelerators
MENU			4	LoadMenu
MENUEX			4	LoadMenu
DIALOG			5	CreateDialogParam, DialogBoxParam
DIALOGEX		5	CreateDialogParam, DialogBoxParam

The ACCELERATORS Resource

The syntax for the ACCELERATORS resource is:-

nameID ACCELERATORS
[defining-statements]
BEGIN
    event, result [,type/options]
    .........
END

Where,

nameID				can be either:-
                        a 16-bit number of value 1 to 7FFFh
                        an expression which evaluates to that number
                        a name

defining-statements		need not be present, but can be either:-
                        a VERSION statement
                        a CHARACTERISTICS statement
                        a LANGUAGE statement

                        see below for details

event				specifies the keystroke which will cause result to be sent to the
                    message loop of the process which loaded the accelerators.
                    It can be either:-
                        a single character enclosed in quotes
                            eg. "a" meaning the key "a"
                        a single character preceded by a caret
                            eg. "^A" meaning the key is a Crtl key
                            if ^ is used the character must be an upper case letter
                        a 16-bit number
                        an expression which evaluates to a 16-bit number
                            eg. the commonly used VK_ names listed in Winuser.h

result				can be either:-
                        a 16-bit number
                        an expression which evaluates to a 16-bit number

type/options			can be any of the following values, separated by commas:-
                        ASCII		(value zero, meaning that the event value refers
                                    to an ASCII character value)
                        VIRTKEY		(1= meaning that the event value refers
                                    to a virtual key value)
                        (if neither ASCII nor VIRTKEY are specified, then ASCII is assumed)
                        SHIFT		(4= event only occurs if Shft key is pressed)
                        CONTROL	(8= event only occurs if Crtl key is pressed)
                        ALT			(10h= event only occurs if Alt key is pressed)
                        NOINVERT	(2= do not highlight a top level menu item if
                                    possible when an accelerator is used)
Example of ACCELERATORS resource
0x20 ACCELERATORS
BEGIN
    "N", 20h, CONTROL
    "^A", 0x1111
    "K", 0x2222
    "k", 0x3333, ALT
    98, 0x4444, ASCII
    66, 0x5555, ASCII
    "g", 0x6666
    "G", 0x7777
    "K", 0x2222, VIRTKEY
    67, 0x5556, VIRTKEY
    68, 0x5557, VIRTKEY, NOINVERT
    VK_F1, 0x8888, VIRTKEY
    VK_F2, 0x8889, CONTROL, VIRTKEY
    VK_F3, 0x888A, SHIFT, VIRTKEY
    VK_LBUTTON, 0x888B, ALT, VIRTKEY
    VK_NUMPAD4, 0x888C, ALT, SHIFT,VIRTKEY
    VK_SPACE, 0x888D, CONTROL, SHIFT,VIRTKEY
    VK_END, 0x888E, ALT, CONTROL,VIRTKEY
END

The MENU Resource

The syntax for the MENU resource is:-

nameID MENU
[defining-statements]
BEGIN
    MENUITEM "text", id [,type/state]
    POPUP "text" [,type/state]
    BEGIN
        MENUITEM "text", id [,type/state]
    END
    MENUITEM SEPARATOR
    .........
END

The syntax for the MENUEX resource is:-

nameID MENUEX [,helpID]
[defining-statements]
BEGIN
    MENUITEM "text", id [,type/state]
    POPUP "text", [id] [,type/state][,helpID]
    BEGIN
        MENUITEM "text", id [,type/state]
    END
    MENUITEM SEPARATOR
END

Where,

nameID				can be either:-
                        a 16-bit number of value 1 to 7FFFh
                        an expression which evaluates to that number
                        a name

defining-statements		need not be present, but can be either:-
                        a VERSION statement
                        a CHARACTERISTICS statement
                        a LANGUAGE statement

                        see below for details

"text"				is a quoted string containing the text for the menu or popup item,
                    which can also contain:-
                        \t	which inserts a tab
                        \a	which aligns to the right all text which follows it
                        &	the system uses the following character as an accelerator key
                        &&	use two ampersands to write &
                    You can have a menu item without any text by having "" in this field,
                    but this simply gives the same result as having a SEPARATOR.
                    If you want a completely empty menu line use " " instead, giving the
                    menu item a string which contains only a space.

id					is the value which is sent to the window procedure of the window
                    which owns the menu. It can be:-
                        a 16-bit number (MENU) or a 32-bit number (MENUEX)
                        an expression which evaluates to the above number

type/state				is one or more of the following words separated by spaces or
                    the | (OR) operator:-

            type
                    MENUBREAK			40h
                            puts the next menu item on a new line or in a new column
                            in the case of popup menus
                    MENUBARBREAK		20h
                            same as above but includes a separator line
                    OWNERDRAW		100h
                            process is responsible for drawing the menu
                    RADIOCHECK		200h
                            radio button used instead of check-mark for checked items
                    RIGHTJUSTIFY		4000h
                            right justifies menu text only, not popups
                    HELP				4000h
                            identifies a help item
                    SEPARATOR			800h
                            for popups only
            state
                    CHECKED			8h
                        checks the menu item
                    GRAYED				3h
                            disables and greys the menu item
                    DISABLED			3h
                            same as above
                    INACTIVE			2h
                            menu item not greyed but cannot be selected
                    HILITE				80h
                            highlights the menu item
                    DEFAULT			1000h
                            displays text in bold and the enter key will act in the same way
                            as a mouse click on this item

                    Instead of using the type/state words, you can use their respective value
                    instead, but ensure that they are inserted as follows:-
                        type,state
                    or	type+type,state+state
                    (type values are first, then comma, then state values)

helpID				(MENUEX only) is the value sent to the window procedure of the window
                    which owns the menu if F1 is pressed when the menu is active. It can be:-
                        a 32-bit number
                        an expression which evaluates to a 32-bit number

                    important - in the POPUP statement, to ensure that the helpID is
                    properly identified, make sure there are a total of 3 commas between
                    id and helpID. This tells the Resource Compiler that helpID is not
                    a type nor a style value.

MENUITEM SEPARATOR	creates a horizontal line in the menu which is useful for
                        separating different types of menu items
Example of MENU resource
#define IDM_NEW 10h
#define IDM_OPEN 20h
GENERIC MENU
BEGIN
    POPUP "&File"
    BEGIN
        MENUITEM "&New...", IDM_NEW, GRAYED
        MENUITEM "&Open...", IDM_OPEN, GRAYED
        MENUITEM SEPARATOR
        POPUP "Send to"
        BEGIN
            MENUITEM "Drive a:"
        END
    END
    POPUP "View"
    BEGIN
        MENUITEM "Toolbar\tCrtl+T", 33h, CHECKED | HILITE
    END
END
Example of MENUEX resource
#define IDM_NEW 10h
#define IDM_OPEN 20h
GENERIC MENUEX 99999999h
BEGIN
    POPUP "nice day", 0x100, CHECKED,,6666666h
    BEGIN
        MENUITEM "&New...", IDM_NEW, MENUBREAK | GRAYED
        MENUITEM "&Open...", IDM_OPEN, GRAYED
        MENUITEM SEPARATOR
        POPUP "Send to"
        BEGIN
            MENUITEM "Drive a:"
        END
    END
    POPUP "View"
    BEGIN
        MENUITEM "Toolbar", 33h, CHECKED | HILITE
    END
END

The DIALOG Resource

The syntax for the DIALOG resource is:-

nameID DIALOG x, y, width, height
[defining-statements]
[dialog-statements]
BEGIN
    iconcontrol
    textcontrol
    non-textcontrol
    generic-control
END

The syntax for the DIALOGEX resource is:-

nameID DIALOGEX x, y, width, height [,helpID]
[defining-statements]
[dialog-statements]
BEGIN
    iconcontrol
    textcontrol [,helpID]
    non-textcontrol [,helpID]
    generic-control [,helpID]
END

Where,

nameID				can be either:-
                        a 16-bit number of value 1 to 7FFFh
                        an expression which evaluates to that number
                        a name

x					is the horizontal position of the dialog in dialog units

y					is the vertical position of the dialog in dialog units

width				is the width of the dialog in dialog units

height				is the height of the dialog in dialog units

helpID				(DIALOGEX only) is the value which is sent to the dialog procedure
                    if F1 is pressed when the dialog is active. A helpID specified for a
                    control is sent if the user clicks the control after having dragged the
                    help question mark. The helpID can be either:-
                        a 32-bit number
                        an expression which evaluates to a 32-bit number

defining-statements		need not be present, but can be either:-
                        a VERSION statement
                        a CHARACTERISTICS statement
                        a LANGUAGE statement

                        see below for details

dialog-statements		need not be present, but can be one or more of the following:-

CAPTION "text"		where "text" is the title of the dialog to insert in the title bar

CLASS class			this statement is used if you have registered your own private window
                    class for the dialog because you want to intercept dialog messages
                    before they go to the system’s default dialog window procedure.

                    class can be either:-
                        a 16-bit number
                        a quoted string

EXSTYLE exstyle		allows an extended style to be specified, which can be one or
                    more of the following extended styles or their respective value
                    separated by the | (OR) operator:-

        WS_EX_DLGMODALFRAME		1h
                has a double border
        WS_EX_NOPARENTNOTIFY		4h
                when window is created or destroyed, does not send the
                WM_PARENTNOTIFY message to the parent window
        WS_EX_TOPMOST			8h
                place above all non-topmost windows and stay above them
        WS_EX_ACCEPTFILES			10h
                accept drag-drop files
        WS_EX_TRANSPARENT		20h
                sibling window(s) beneath the window get painted first
        WS_EX_MDICHILD			40h
                a MDI child window
        WS_EX_TOOLWINDOW		80h
                for use as a floating toolbar
        WS_EX_WINDOWEDGE		100h
                border has a raised edge
        WS_EX_CLIENTEDGE			200h
                border has a sunken edge
        WS_EX_OVERLAPPEDWINDOW	300h	which is the same as
                WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE
        WS_EX_PALETTEWINDOW		188h	which is the same as
                WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST
        WS_EX_CONTEXTHELP		400h
                title bar include a question mark for use with
                WM_HELP message processing to display help
        WS_EX_LEFT					0h
                default left-aligned properties
        WS_EX_RIGHT				1000h
                right-align properties for shell languages supporting
                reading-order alignment
        WS_EX_LTRREADING			0h
                default left-to-right reading-order properties
        WS_EX_RTLREADING			2000h
                right-to-left reading-order properties for shell
                languages supporting reading-order alignment
        WS_EX_RIGHTSCROLLBAR		0h
                default position to the right of the client area
        WS_EX_LEFTSCROLLBAR		4000h
                positioned to the left of the client area for shell
                languages supporting reading-order alignment
        WS_EX_CONTROLPARENT		10000h
                child windows are included in dialog box navigation
        WS_EX_STATICEDGE			20000h
                border has a three-dimensional style
        WS_EX_APPWINDOW			40000h
                top-level window when visible shows on taskbar
        WS_EX_LAYERED				80000h
                a layered window generally with a complex/animated
                shape or alpha blending
        WS_EX_NOINHERITLAYOUT	100000h
                window layout does not get passed to child windows
        WS_EX_LAYOUTRTL			400000h
                horizontal origin on right edge of window for shell
                languages supporting reading-order alignment
        WS_EX_COMPOSITED			2000000h
                descendants of the window get painted in bottom-to-top
                order using double-buffering
        WS_EX_NOACTIVATE			8000000h
                if a top-level window, does not become the foreground
                window or show on the taskbar

FONT pointsize, "typeface"							;if DIALOG
FONT pointsize, "typeface" [,weight, italic, charset]		;if DIALOGEX
                    this statement must be present if the dialog has the DS_SETFONT
                    style and it contains the information which the system uses to write the
                    text within the dialog box and its controls. If this statement is present
                    the dialog box is given the style DS_SETFONT automatically.

            pointsize		is a 16-bit number giving the size of the font

            typeface		is a quoted string giving the name of the typeface

            weight		(DIALOGEX only) is either:-
                            a 16-bit number
                            an expression which evaluates to a 16-bit number
                            one of the words known to the Resource Compiler set
                            out below (the weight is given in the second column):-
                                FW_DONTCARE	0
                                FW_THIN		100
                                FW_EXTRALIGHT	200
                                FW_LIGHT		300
                                FW_NORMAL		400
                                FW_MEDIUM		500
                                FW_SEMIBOLD	600
                                FW_BOLD		700
                                FW_EXTRABOLD	800
                                FW_HEAVY		900

                        if this parameter is omitted it is set to zero (don’t care)

            italic			(DIALOGEX only) indicates whether italics should be used and
                        is either:-
                            the number 0 or the word FALSE to indicate not italic, or
                            the number 1 or the word TRUE to indicate italic

                        if this parameter is omitted it is set to zero (non-italic)

            charset		(DIALOGEX only) indicates the character set for the dialog and
                        is either:-
                            an 8-bit number
                            an expression which evaluates to an 8-bit number
                            one of the words known to the Resource Compiler set
                            out below (the value is given in the second column):-
                                ANSI_CHARSET			0
                                DEFAULT_CHARSET		1
                                SYMBOL_CHARSET		2
                                SHIFTJIS_CHARSET		128
                                HANGEUL_CHARSET		129
                                HANGUL_CHARSET		129
                                GB2312_CHARSET		134
                                CHINESEBIG5_CHARSET	136
                                OEM_CHARSET			255
                                JOHAB_CHARSET			130
                                HEBREW_CHARSET		177
                                ARABIC_CHARSET		178
                                GREEK_CHARSET			161
                                TURKISH_CHARSET		162
                                VIETNAMESE_CHARSET	163
                                THAI_CHARSET			222
                                EASTEUROPE_CHARSET	238
                                RUSSIAN_CHARSET		204
                                MAC_CHARSET			77
                                BALTIC_CHARSET			186

                        if this parameter is omitted it is set to zero (don’t care)

MENU menuname		this statement if present specifies a menu for the dialog
                    box and menuname is either:-
                        a 16-bit number identifying the menu (this would be the
                            number given as the nameID of the menu resource)
                        an expression which evaluates to that number (or the name
                            of a menu resource if the nameID of the menu was a name)

STYLE styles			this statement is used to change the default dialog box style which is:-
                    WS_POPUP | WS_BORDER | WS_SYSMENU, which is the same as
                    80000000h | 800000h | 80000h

                    To remove an unwanted default style you can use the word NOT or
                    the ! symbol. For example STYLE NOT SYSMENU or STYLE !80000h
                    would produce a dialog box with the style of WS_POPUP and
                    WS_BORDER only.

                    The following dialog styles and their respective values can
                    be used in this statement:-

        DS_ABSALIGN				1h
                the co-ordinates of the dialog box are screen co-ordinates
                as opposed to client co-ordinates
        DS_SYSMODAL				2h
                gives the dialog box the WS_EX_TOPMOST style
        DS_FIXEDSYS				8h
                use the system’s fixed font rather than the proportional font
        DS_NOFAILCREATE			10h
                make the dialog box even if there are errors in making the controls
        DS_SETFONT					40h
                looks for the FONT statement for the font to be used for the controls
                and for text in the dialog box
        DS_MODALFRAME			80h
                creates a dialog box with a modal dialog frame which can be combined
                with WS_CAPTION and WS_SYSMENU styles
        DS_NOIDLEMSG				100h
                suppresses WM_ENTERIDLE messages that the system would otherwise
                send to the owner of the dialog box
        DS_SETFOREGROUND		200h
                system to call SetForegroundWindow when the dialog is created
        DS_CONTROL				400h
                make the dialog box work like the child window of another dialog box
        DS_CENTER					800h
                centre the dialog box as far as possible on the screen
        DS_CENTERMOUSE			1000h
                centre the mouse cursor in the dialog box
        DS_CONTEXTHELP			2000h
                add a question mark to the title bar for help processing

                    The following window styles and their respective values can
                    also be used in this statement:-

        WS_TILED					same as
        WS_OVERLAPPED			0h
                an overlapped window with a title bar and border
        WS_MAXIMIZEBOX			10000h
                has a maximizebox in the title bar
        WS_MINIMIZEBOX				20000h
                has a minimizebox in the title bar
        WS_THICKFRAME				same as
        WS_SIZEBOX					40000h
                has a thick frame border for resizing
        WS_SYSMENU				80000h
                has a system menu in its title bar
        WS_HSCROLL				100000h
                has a horizontal scroll bar
        WS_VSCROLL				200000h
                has a vertical scroll bar
        WS_DLGFRAME				400000h
                creates a modal dialog box type of frame for the
                window which cannot have a title bar
        WS_BORDER					800000h
                has a thin-line border
        WS_CAPTION					0C00000h	which is the same as
                WS_BORDER | WS_DLGFRAME
                and has a title bar
        WS_TILEDWINDOW			same as
        WS_OVERLAPPEDWINDOW	0C80000h	which is the same as
                WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | \
                WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX
                an overlapped window combined with other styles
        WS_MAXIMIZE				1000000h
                created initially maximized
        WS_CLIPCHILDREN			2000000h
                a parent window can use this to exclude child window
                areas when drawing within the parent window
        WS_CLIPSIBLINGS			4000000h
                clips overlappping child windows out of the update region
                for the WM_PAINT message
        WS_DISABLED				8000000h
                initially created as disabled
        WS_VISIBLE					10000000h
                initially created as minimized
        WS_MINIMIZE				20000000h
                initially created as minimized
        WS_CHILD					40000000h
                a child window which cannot have a menu bar, and
                cannot be used with the WS_POPUP style
        WS_POPUP					80000000h
                a pop-up window which
                cannot be used with the WS_CHILD style
        WS_POPUPWINDOW			80880000h	which is the same as
                WS_POPUP | WS_BORDER | WS_SYSMENU
                a pop-up window, used with WS_CAPTION to make the
                window menu visible

iconcontrol			displays an icon in the dialog box. The syntax for an iconcontrol is:-

                    ICON nameID, id, x, y

                    Where,

                    nameID	is the identifier of an ICON resource and is either:-
                                a 16-bit number of value 1 to 7FFFh
                                an expression which evaluates to that number
                                a quoted string containing the name of the ICON
                                    if the icon is identified by name

                    id		can be either:-
                                a 16-bit number (DIALOG) or a 32-bit number (DIALOGEX)
                                an expression which evaluates to the above number

                    x		is the horizontal position of the icon

                    y		is the vertical position of the icon

textcontrol			is a dialog control which contains text and which has a name which is
                    recognised by the Resource Compiler. The name of the type of control
                    causes the Resource Compiler to give the control the correct class and a
                    default style. To remove a default style you will need to use the NOT
                    specifier, as you would to remove a default style for the dialog itself.
                    The syntax for a textcontrol is:-

                    textcontrol "text", id, x, y, width, height, [,style[,extendedstyle]]
                    BEGIN
                        data-elements
                    END

                    Where,

                    textcontrol		is one of the names given below, listed here
                                    with their class and default style:-

                    LTEXT			static class, SS_LEFT | WS_GROUP
                                    creates a static control with left aligned text
                    CTEXT			static class, SS_CENTER | WS_GROUP
                                    creates a static control with centred text
                    RTEXT			static class, SS_RIGHT | WS_GROUP
                                    creates a static control with right-aligned text
                    GROUPBOX		button class, BS_GROUPBOX
                                    creates a labelled rectangle in the dialog box
                                    inside which other controls can be grouped
                    CHECKBOX		button class, BS_CHECKBOX | WS_TABSTOP
                                    creates a check box control (small rectangle with text
                                    next to it)
                    AUTOCHECKBOX	button class, BS_AUTOCHECKBOX | WS_TABSTOP
                                    creates a check box control which automatically
                                    changes to checked or unchecked when the user
                                    clicks in the control
                    STATE3			button class, BS_3STATE | WS_TABSTOP
                                    creates a check box control which has 3 states
                                    checked, unchecked, and disabled (greyed)
                    AUTO3STATE		button class, BS_AUTO3STATE | WS_TABSTOP
                                    creates a STATE3 control which automatically toggles
                                    when clicked between the 3 states
                    RADIOBUTTON	button class, BS_RADIOBUTTON | WS_TABSTOP
                                    creates a radio button control
                    AUTORADIOBUTTON		button class,
                                    BS_AUTORADIOBUTTON | WS_TABSTOP
                                    creates an automatic radio button
                    PUSHBUTTON	button class, BS_PUSHBUTTON | WS_TABSTOP
                                    creates an ordinary push button control containing text
                    DEFPUSHBUTTON	button class,
                                    BS_DEFPUSHBUTTON | WS_TABSTOP
                                    creates an ordinary push button control containing text
                                    and showing as the default if the user presses enter
                    PUSHBOX		button class,
                                    BS_USERBUTTON | BS_CHECKBOX | WS_TABSTOP
                                    giving a flat appearance to the button

                    "text"	is the text to appear in the control

                    id		can be either:-
                                a 16-bit number (DIALOG) or a 32-bit number (DIALOGEX)
                                an expression which evaluates to the above number

                    x		is the horizontal position of the control in dialog units

                    y		is the vertical position of the control in dialog units

                    width	is the width of the control in dialog units

                    height	is the height of the control in dialog units

                    style				see above for details

                    extendedstyle		see above for details

                    data-elements		are one or more elements of data, called "creation data".
                            A pointer to this data is sent to the dialog procedure in the
                            lParam parameter of the WM_CREATE message when the
                            control is created. The data is made using the same format
                            as for the RCDATA resource.

non-textcontrol			is similar to a textcontrol except that it does not contain text	in the first
                    instance (this must be added at run-time).
                    The syntax for a non-textcontrol is:-

                    non-textcontrol id, x, y, width, height, [,style[,extendedstyle]]
                    BEGIN
                        data-elements
                    END

                    Where the id, x, y, width, height, style and extendstyle parameters are the
                    same as for the text-control.

                    non-textcontrol		is one of the names given below,
                                    listed here with their class and default style:-

                    EDITTEXT		edit class, ES_LEFT | WS_BORDER | WS_TABSTOP
                                    creates a simple edit control
                    HEDIT			handwriting edit (pen) control
                    IEDIT			ink edit (pen) control
                    LISTBOX			listbox class, LBS_NOTIFY | WS_BORDER
                                    creates a basic listbox
                    SCROLLBAR		scrollbar class, SBS_HORZ
                                    creates a basic scrollbar
                    COMBOBOX		combobox class, CBS_SIMPLE
                                    creates a basic combobox control

generic-control			is a control where you explicitly specify the class of the control.
                    It is mainly used for those control classes which do not come into the
                    button, edit, static, listbox, scrollbar, or combobox classes. However,
                    you can use the generic-control syntax to make those controls too.
                    The syntax for a generic-control is as follows:-

                    CONTROL "text", id, class, style, x, y, width, height [,style,[extendedstyle]]
                    BEGIN
                        data-elements
                    END

                    Where the id, x, y, width, height, style and extendstyle parameters are
                    the same as for the text-control. Note that here there are no default styles,
                    other than WS_CHILD and WS_VISIBLE, so style and extendedstyle
                    should be chosen to suit the particular control being made.

                    "text"	can be either:-
                                a quoted string containing the text for the control
                                    or "" if it has no text
                                in the case of a STATIC class control which has the
                                    SS_BITMAP style, "text" can be a 16-bit number
                                    representing the bitmap concerned
                                an expression which evaluates to the above text or number

                            For the controls which do not normally take initial text,
                            (see non-textcontrols above) you must include an empty
                            text string by specifying "", for the text parameter.

                    class	can be either:-
                                a 16-bit number of value 80h to 85h
                                    (if one of the first six in the list below)
                                an expression which evaluates to the above number
                                a quoted string containing the name of the class shown
                                    in the second column of the list below
                                a word shown in the first column of the list below
                                a quoted string (for a user-defined class)

                            The class can therefore be one of the following:-

                    BUTTON					"Button"			80h
                    EDIT					"Edit"			81h
                    STATIC					"Static"			82h
                    LISTBOX					"Listbox"			83h
                    SCROLLBAR				"Scrollbar"		84h
                    COMBOBOX				"ComboBox"		85h
                    WC_HEADER				"SysHeader32"
                    WC_LISTVIEW			"SysListView32"
                    WC_TREEVIEW			"SysTreeView32"
                    HOTKEY_CLASS			"msctls_hotkey32"
                    UPDOWN_CLASS			"msctls_updown32"
                    ANIMATE_CLASS			"SysAnimate32"
                    WC_COMBOBOXEX		"ComboBoxEx32"
                    WC_TABCONTROL		"SysTabControl32"
                    MONTHCAL_CLASS		"SysMonthCal32"
                    PROGRESS_CLASS		"msctls_progress32"
                    REBARCLASSNAME		"ReBarWindow32"
                    TOOLTIPS_CLASS			"tooltips_class32"
                    TRACKBAR_CLASS		"msctls_trackbar32"
                    STATUSCLASSNAME		"msctls_statusbar32"
                    TOOLBARCLASSNAME		"ToolbarWindow32"
                    DATETIMEPICK_CLASS	"SysDateTimePick32"
                    WC_IPADDRESS			"SysIPAddress32"
                    WC_PAGESCROLLER		"SysPager"
                    WC_NATIVEFONTCTL		"NativeFontCtl"
                    DRAGLISTMSGSTRING		"commctrl_DragListMsg"

Example of a DIALOG resource
AboutBox DIALOG 100, 100, 160, 72
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
FONT 8,"MS Sans Serif"
CAPTION "About it"
BEGIN
    CTEXT "Application", -1, 0, 8, 160, 8
    CTEXT "Version 1.2", -1, 0, 16, 160, 8
    DEFPUSHBUTTON "OK", IDOK, 55,52,50,14
    CONTROL 23h,-1,"Static",SS_BITMAP,9,6,125,41
    ICON "MyIcon" -1, 20, 10,0,0
END
Example of a DIALOGEX resource
0x45 DIALOGEX 0x30, 0x20, 0x200, 0x400, 0x98
CAPTION "goodbye"
MENU mymenu
FONT 10,"Times New Roman",FW_NORMAL,1
BEGIN
    CTEXT "hello", 0x20,0x10,0x10,0x10,0x10,,WS_EX_PALETTEWINDOW, 0x333
    COMBOBOX 0x456,30005,4560,300,20
    BEGIN
        0x888888L
        L"hello folks"
        0x99,0x67,0x5555
    END
    CONTROL "ducks",0x460,"ComboBoxEx32",0x100,30005,4560,300,20
    CONTROL "drakes",0x461,0x85,0x100,30005,4560,300,20
    CONTROL "hens",0x462,"Button",0x100,30005,4560,300,20
    CONTROL "and",0x463,"Own class",0x100,30005,4560,300,20
    CONTROL "chickens",0x464,STATUSCLASSNAME,0x100,30005,4560,300,20
    ICON "ANI_ICON",0x465, 6, 9, 18, 20
END

Defining Statements

Defining statements give some further definition to each resource. There are three types of defining-statement:-

  • VERSION statement
  • CHARACTERISTICS statement
  • LANGUAGE statement

Each defining statement is specific to the resource to which it refers, however if LANGUAGE is specified outside a specific resource it will apply to all resources thereafter.

VERSION and CHARACTERISTICS

The syntax for these is the same:-

VERSION value
CHARACTERISTICS value

Where,

value		can be either:-
                a 32-bit number
                an expression which evaluates to a 32-bit number

The value is stored only in the RES file and not in the OBJ file nor in the EXE, so it cannot be recovered at run-time. However it could be read by tools which work with the RES file, such as some linkers.

LANGUAGE

The syntax of the LANGUAGE statement is:-

LANGUAGE language, sublanguage

This statement can appear anywhere in the script (outside a BEGIN...END section). In that case the specified language applies to all resources thereafter. It can also appear between the resource statement itself and the BEGIN...END section as a defining-statement. In that case the specified language only applies to the resource in which it appears.

The actual values for language and sublanguage appear in WINNT.H. The most common values for language are LANG_ENGLISH (value 9h), and for sublanguage are SUBLANG_ENGLISH_US (value 1h), SUBLANG_ENGLISH_UK (value 2h), SUBLANG_ENGLISH_AUS (value 3h) and SUBLANG_ENGLISH_CAN (value 4h). If no language is specified in your resource script the Resource Compiler uses the system language and inserts that in the binary resource file.

Making different language versions of a resource

If your product is to be used in more than one language, you will need to provide different menu and dialog text, warning and error messages to suit the language. The combined features of the Resource Compiler and the API make it reasonably easy to achieve this. The exact way this is achieved, in the context of resources, depends on whether you want:-

  • different EXE or DLL files for each language version, or
  • several languages available from the same EXE

The first can be achieved by having different resource scripts, or by use of the conditional directives, which would instruct the Resource Compiler to compile only those parts of the resource script relevant to the desired language (see conditional directives above).

The second is possible because the API FindResource will automatically return the handle of the resource which suits the default system language for the computer which is running the program. FindResource does this by obtaining the default system language and then calling FindResourceEx. If you want to specify the language of the resource to be found, rather than relying on the system default language, then you can call FindResourceEx directly giving the language ID.

FindResource can be used as follows:-

PUSH resource type		;by type number or by name if a user-defined resource
PUSH resource nameID		;use only a name identifier not a number
PUSH hModule 			;this is hInst or zero to use current process
CALL FindResource

FindResourceEx can be used as follows

PUSH resource language	;see below
PUSH resource nameID		;use only a name identifier not a number
PUSH resource type		;by type number or by name if a user-defined resource
PUSH hModule			;this is hInst or zero to use current process
CALL FindResourceEx

Note that the nameID and type parameters are reversed for FindResourceEx!
The resource language is a 32-bit value made up as follows:-
Least significant 10 bits - the primary language value:
Next 6 bits - the secondary language value
Most significant 16 bits - zero
For a list of the language values see WINNT.h

The return from FindResource and FindResourceEx is the handle which is needed for the call to LoadResource. You can have several versions of a menu or dialog, for example, with the same nameID but with different languages specified. FindResource will return the handle of the correct one.

Language specific menus

Since the FindResource (or FindResourceEx) and LoadResource combination provide an address to the resource data itself, in order to load a language specific menu, you need to pass that address as the menu template to LoadMenuIndirect. You cannot use LoadMenu to load a language specific menu.

Language specific dialogs

Similarly, to make a language specific dialog box you need to pass the address of the dialog template returned by LoadResource to DialogBoxIndirect (modal) or CreateDialogIndirect (non-modal) rather than using the CreateDialog and DialogBox APIs. Other language specific components which are needed in your dialog should either be given a unique nameID or loaded at run-time. For example, if you have a French version of your dialog and want to include a French menu by using the MENU defining-statement in the resource script, a nameID must be given in the MENU statement which uniquely refers to the French menu. Alternatively if you have several language versions of the menu all with the same nameID you could load the menu at run-time upon the INIT_DIALOG message. This would be done by calling FindResource or FindResourceEx, then LoadResource (to get and address for the menu template of the correct menu), LoadMenuIndirect (to get the menu handle) and then SetMenu (to load the menu into the dialog box).

Language specific strings and raw data

When loading language specific strings, you can use LoadString directly. This loads a string to suit the system default language. Alternatively the address of the string itself can be obtained using FindResource, or FindResourceEx and LoadResource. The same method works for RCDATA and for a user-defined resource (and indeed for any resource which can be used by obtaining an address of the raw data of the resource).

Examples for viewing

Testbug.Exe provides examples of loading language specific menus, dialogs, strings and raw data. The relevant functions to look at with the debugger are:-

Menus, dialogs and raw data example, click "use of resources/different language versions/various resources in English" or "same showing French versions" in the menu, watching with the debugger the functions RESOURCES_IN_ENGLISH and RESOURCES_IN_FRENCH, which create dialog boxes using the dlg wndproc called MDLangDlgProc.

Strings, click "Language specific string" in the menu, watching with the debugger the function STRINGTABLES_BY_LANGUAGE.

Language search criteria

When searching for language specific resources, the system looks for a language match but has certain defaults if an exact match is not found. The system carries out the search for a resource of the correct type and ID in this order, moving down the list if the resource is not yet found:-

  • Match both of primary language and sublanguage
  • Match on primary language only
  • A primary language of LANG_NEUTRAL (value zero)
  • A primary language of English
  • Any language

Clearly if the exact specified language is not present in the EXE, FindResourceEx will provide some output provided the resource type and ID match. So there is no need to worry that your product will not work in the Land of the Wizard if you use language specific resources.

Own language values

You can specify your own language values if you wish, and by this method it would be possible to make several versions of menus, dialogs and strings for your product in the same language if you wished, using the automatic language selection referred to above. To keep the system happy, ensure that your language value is between 200h and 3FFh, and the sublanguage value is between 20h and 3Fh. These values are carefully chosen. The actual languageID inserted in the binary resource file and kept in the EXE is only 16 bits long, the language value occupying the most significant 10 bits (hence a maximum value of 3FFh) and the sublanguage value occupying the least significant 6 bits (hence a maximum value of 3Fh).

Examples of the LANGUAGE statement
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
456h RCDATA
BEGIN
    "Hello world (in English)\0"
END

456h RCDATA
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
BEGIN
    "Bonjour le monde (en Français)\0"
END

STRINGTABLE
BEGIN
    55h "An English string"
END

LangMenu MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
BEGIN
    MENUITEM "English menu item" 22h
END

LangMenu MENU
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
BEGIN
    MENUITEM "Version française" 22h
END

Capitalisation of nameIDs and types

We have seen that a resource nameID can either be a string of characters or a number. For each type of resource with a particular language the nameID must be unique. Ie. two dialogs can have the same nameID provided they have different language values. We have also seen that a user-defined resource will have a resource type identified by a string of characters or a number.

Now, the Resource Compiler will always convert the nameID or type to upper case when inserting them in the RES file or OBJ file. The reason for this is that this is expected by Windows. In practice this does not affect the way you use the resource because the system will also capitalise any nameIDs or types given to the resource APIs. For example suppose you have a dialog with a nameID of "MyDlg". Then to use the dialog you would pass the string "MyDlg" to the API CreateDialog. But in fact, the system converts the string to MYDLG and then looks for that string (as converted) in the executable.

This has two implications which you may need to be aware of.

Firstly it means that there would be a conflict in the above example if you had a second dialog (with the same language value) called MYDLG. This would be picked up at link-time by the linker.

Secondly, the Resource Compiler must ensure that not only English nameIDs or user-defined types are converted properly to upper case. So the Resource Compiler relies on the API CharUpper to do this conversion. This API can handle a number of languages properly, but it does rely on language mapping. Ensure that the machine used for compiling does support the language used in the nameIDs and user-defined types. Many languages do not actually have an upper case at all, in which case no conversion will take place.

Legal Stuff

Copyright

GoRC is Copyright © Jeremy Gordon 1997-2013 [MrDuck Software] - all rights reserved.

GoRC - licence and distribution

You may use GoRC for any purpose including making commercial programs. You may redistribute it freely (but not for payment nor for use with a program or any material for which the user is asked to pay). You are not entitled to hide or deny my copyright.

Disclaimer

I have made every effort to ensure that GoRC's output is accurate, but you do use it entirely at your own risk. I cannot accept any liability for it failing to work properly or giving the wrong output nor for any errors in this manual.


Resource Hacker

Vu dans ... http://www.angusj.com/resourcehacker

Resource HackerTM

... a freeware resource compiler & decompiler for Windows® applications

Version 5.1.6
Last updated: 31 July 2018
Copyright © 1999-2018 Angus Johnson
Freeware - no nags, no ads and fully functional.

Overview:

Resource Hacker™ is a resource editor for 32bit and 64bit Windows® applications. It's both a resource compiler (for *.rc files), and a decompiler - enabling viewing and editing of resources in executables (*.exe; *.dll; *.scr; etc) and compiled resource libraries (*.res, *.mui). While Resource Hacker™ is primarily a GUI application, it also provides many options for compiling and decompiling resources from the command-line.

Resource Hacker

Compiling:

Compiling can be initiated either by opening an existing resource script file, or by creating one from scratch using Resource Hacker's editor.

A complete list of Resource-Definition Statements can be found here.

Additional features of Resource Hacker's compiler include: The #INCLUDE directive (to access definition statements in header files etc) can be nested to multiple levels, as can the #IF, and #IFDEF directives. #DEFINE, #UNDEF, #IF, #ELIF, #ELSE, #IFDEF, #IFNDEF, #INCLUDE, and #PRAGMA directives are all supported. Strings, between double-quote (") characters, may contain typical 'C' style backslashed 'escaped' characters — \t , \n , \\ , \" , \x, \u and \377 (octal). A double-quote within a string must be 'escaped' using either a preceding backslash or with another double-quote. Script comments are preceded either by double forward-slashes (//) or by a semi-colon (;). Filenames with relative paths are allowed. Filenames that contain spaces must be enclosed within double-quote characters.

Compiler error messages are reported, even errors nested within INCLUDE statements ...

Viewing and Editing Resources:

Once a resource file has been opened, its resources will generally be displayed as either an image (or group of images) or as decompiled text. Binary resources, usually images, can't be edited directly with Resource Hacker, but they can still be very easily exported and imported once they've been modified by an external image editor. (I see no benefit in duplicating what third-party image editors do so well.)

Menu and Dialog resource types have their own WYSIWYG designers:

Binary resources that have unknown formats will be displayed as read-only binary text. (Any resource can also be viewed in this fashion if desired.)

Other Actions:

Command Line Syntax:

Just about all the functionality of Resource Hacker™ can be accessed from the command line without having to open the Resource Hacker™ GUI.
Command line instructions and Resource Hacker™ scripts can remove the drudgery entailed with repeating Resource Hacker™ tasks.
Command-line instructions are a combination of switch statements followed by switch parameters as explained in the following table: Command line statements:

Switch | Parameter
-open | filename - the name of the file that is to be modified. It should be a Windows PE file (*.exe, *.dll etc) or a compiled or uncompiled resouce file (*.res or *.rc)
-save | usually a filename for the new or modified file, but can also be a folder when extracting multiple resources
-resource | filename - contains a resource being added to the opened file.
-action action to be performed on the opened file
  • add - add a resource, but fails if it already exists
  • addoverwrite - add a resource, and overwriting if it already exists
  • addskip - add a resource, but skipping if it already exists
  • compile - compiles a resource script file (*.rc) to a binary resource file (*.res)
  • delete - delete a resource
  • extract - extract a resource
  • modify - modify a resource
  • changelanguage(langID) - changes the language of ALL resources
-mask resource mask - Type,Name,Language
commas are mandatory but each of Type, Name & Language are optional
-log Filename or CONSOLE or NUL
CONSOLE can be abbreviated to CON
Logs the details of the operation performed
If this switch is omitted, the log will be written to resourcehacker.log
-script | filename - contains a multi-command script, NOT a resource script for more info: -help script
-help | options - command-line or script (always logged to CONSOLE) other switches are ignored.

Notes:
  1. Switch identifiers (except -script) may be abbreviated down to a single char (eg -res or -r).
  2. Switch instructions do not have to be in any particular order.
  3. File names that contain spaces must be enclosed within double quotes.

Batch file Examples (using rh.exe instead of ResourceHacker.exe in places for brevity)

reshack_help.bat:
ResourceHacker.exe -help
@pause  :: to see the console output before the CMD window closes.

reshack_compile_res_script.bat:
rh.exe -open .\in\resources.rc -save .\out\resources.res -action compile -log NUL

reshack_add_icon_to_old.bat:
rh.exe -open old.exe -save new.exe -action addskip -res my.ico -mask ICONGROUP,MAINICON,

reshack_extract_all_source_icons_to_icons_folder.bat:
rh.exe -open source.exe -save .\icons -action extract -mask ICONGROUP,, -log CON
@pause

reshack_extract_all_dialogs.bat:
rh.exe -open source.exe -save .\dialogs.rc -action extract -mask DIALOG,, -log rh.log

reshack_execute_my_script.bat:
ResourceHacker.exe -script myscript.txt

Resource Hacker™ Scripts:

Resource Hacker™ Scripts are executed from the command-line using the following syntax:

  ResourceHacker.exe -script ScriptFile

Resource Hacker™ Scripts are text files with the following format:

  //comments are preceded by double slashes
  [FILENAMES]
  Open=
  Save=
  Log=
  [COMMANDS]
  //one or more of the following commands ...
  -add          SourceFile, ResourceMask
  -addskip      SourceFile, ResourceMask
  -addoverwrite SourceFile, ResourceMask
  -addoverwrite SourceFile, ResourceMask
  -modify       SourceFile, ResourceMask
  -extract      TargetFile or TargetFolder, ResourceMask
  -delete       ResourceMask
  -changelanguage(langID)

Note: Filenames that include spaces must be enclosed within double quotes.

Resource Hacker™ Script examples:

rh_script_myprog_rus.txt -
  //This script deletes all Language Neutral (0)
  //string-table, menu and dialog resource items
  //in MyProg.exe before replacing them
  //with Russian (1049) items...
  [FILENAMES]
  Exe=    MyProg.exe
  SaveAs= MyProg_Rus.exe
  Log=    MyProg_Rus.log
  [COMMANDS]
  -delete  MENU,,0
  -delete  DIALOG,,0
  -delete  STRINGTABLE,,0
  -add     MyProg_Rus.res, MENU,,1049
  -add     MyProg_Rus.res, DIALOG,,1049
  -add     MyProg_Rus.res, STRINGTABLE,,1049

rh_script_myprog_upd_images.txt -
  //This script updates 2 bitmaps and an
  //icon in MyProg.exe ...
  [FILENAMES]
  Exe=    MyProg.exe
  SaveAs= MyProg_Updated.exe
  [COMMANDS]
  -addoverwrite Bitmap128.bmp, BITMAP,128,
  -addoverwrite Bitmap129.bmp, BITMAP,129,0
  -addoverwrite MainIcon.ico, ICONGROUP,MAINICON,0

rh_script_myprog_upd_all.txt -
  //This script replaces all resources
  //in MyProg.exe with all the resources
  //in MyProgNew.res
  [FILENAMES]
  Exe=    MyProg.exe
  SaveAs= MyProg_Updated.exe
  [COMMANDS]
  -delete  ,,,            //delete all resources before...
  -add MyProgNew.res ,,,  //adding all the new resources

"Packed" or "Compressed" Executables:

Some executable files are "packed" or "compressed" using compression algorithms. Not only does this reduces file size, it also makes viewing and modifying resources marginally more difficult. I suspect that this resource 'hiding' is (or was) a common objective in this process. Anyhow, in deference to these authors, I've chosen not to unpack files with Resource Hacker. As a side note, it seems that "packed" executables have become quite uncommon over the last 5-10 years, and software authors are exposing more rather than less information in executable resources. I suspect that earlier concerns about the loss of intellectual property with reverse engineering have been allayed.

Licence to Use - Terms and Conditions:

This Resource HackerTM software is released as freeware provided that you agree to the following terms and conditions:
  1. This software is not to be distributed via any website domain or any other media without the prior written approval of the copyright owner.
  2. This software is not to be used in any way to illegally modify software.
DISCLAIMER: A user of this Resource HackerTM software acknowledges that he or she is receiving this software on an "as is" basis and the user is not relying on the accuracy or functionality of the software for any purpose. The user further acknowledges that any use of this software will be at the user's own risk and the copyright owner accepts no responsibility whatsoever arising from the use or application of the software.

The above licence terms constitute "copyright management information" within the meaning of Section 1202 of Title 17 of the United States Code and must not be altered or removed from the licensed works. Their alteration or removal from the licensed works, and the distribution of licensed works without all the above licence terms in an unaltered way, may contravene Section 1202 and give rise civil and/or criminal consequences.

Download version 5.1.6:

http://www.angusj.com/resourcehacker/reshacker_setup.exe EXE install (2.9MB)

http://www.angusj.com/resourcehacker/resource_hacker.zip ZIP install (3.0MB)

Changes since version 5.1.0:
  • Bugfix: incorrect editor fonts when displaying multibyte characters
  • Bugfix: compiler mishandled hex. escape chars with ambiguous trailing text.
  • Bugfix: incorrect handling of #define directive
  • Bugfix: incorrect handling of statusbar alignment in dialog resources
  • Bugfix: line numbering broken when swapping between editing and binary views
  • Bugfix: relative paths in filenames was broken
  • Bugfix: incorrect error reporting while parsing some #include files
  • Bugfix: extracting resources using commandline scripts was buggy.
  • Added: added support for multi-line comments /* ... */
  • Updated: can now open and save non-resource type text files
  • Updated: context help improved


Vu dans ... https://docs.microsoft.com/en-us/windows/desktop/menurc/using-rc-the-rc-command-line

Using RC (The RC Command Line)

  • 05/31/2018
  • 3 minutes to read

In this article

  1. Options
  2. Remarks
  3. Related topics

To start RC, use the following command.

RC [options] script-file

The script-file parameter specifies the name of the resource-definition file that contains the names, types, filenames, and descriptions of the resources to be compiled.

RC can generate separate resource files for applications that have both language-neutral and language-specific resources. Developers can use a resource configuration file or set command-line options to select which resource types and items are non-localizable resources of the language-neutral (LN) file and which are localizable resources of language-specific MUI files. For more information, see the Multilingual User Interface.

The options parameter can be one or more of the following command-line options.

Options

/?

Displays a list of command-line options.

/c

Defines a code page used by NLS conversion.

/d

Defines a symbol for the preprocessor that you can test with the #ifdef directive.

/fm mresname

RC creates one language-neutral .RES file and one language-dependent (MUI) .RES file using script-file. This option must be used together with the /fo resname option. RC names the language-neutral .RES file resname.res and names the language-dependent (MUI) .RES file mresname.res.

Windows Server 2003 and Windows XP/2000: This option is not available without also using the LoadMUILibrary and FreeMUILibrary functions on an updated system.

/fo resname

RC creates a .RES file named resname using script-file.

If the /fm mresname option is also set, RC creates one language-neutral .RES file and one language-dependent (MUI) .RES file.

Windows Server 2003 and Windows XP/2000: This option is not available without also using the LoadMUILibrary and FreeMUILibrary functions on an updated system.

/g1

If /g1, is set, RC generates a MUI file if the only localizable resource being included in the MUI file is a version resource. If /g1 is not set, RC will not generate a MUI file if the only localizable resource being included in the MUI file is a version resource.

/h

Displays the list of command-line options.

/I

Searches the specified directory before searching the directories specified by the INCLUDE environment variable.

/j loctype

Localizable resource types RC places into the language-dependent (MUI) .RES file. If the /q option is also set, this option is ignored, and the information in the RC Configuration file takes precedence.

Windows Server 2003 and Windows XP/2000: This option is not available without also using the LoadMUILibrary and FreeMUILibrary functions on an updated system.

/k overtype

Overlapping resource types that RC places into both the language-neutral .RES and the language-dependent (MUI).RES files. The resource types that are specified by the /k option must be a subset of those that are specified by the /j option. For example, ?J2 ?J3 ?K3 specifies that RC places resource type 3 in both the language-neutral and language-dependent (MUI) files. If the /q option is also set, this option is ignored, and the information in the RC Configuration file takes precedence.

Windows Server 2003 and Windows XP/2000: This option is not available without also using the LoadMUILibrary and FreeMUILibrary functions on an updated system.

/l langid

Specifies the default language for compilation. For example, -l409 is equivalent to including the following statement at the top of the resource script file: LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US

For more information, see Language Identifiers.

/n

Null terminates all strings in the string table.

/q Mui.RCConfig

An RC configuration file that follows the RC Configuration File format. The RC Configuration File format enables components to self-describe resource information such as resource versioning, MUI file path, resource types and items. This file specifies which resources go into the language-neutral .RES file and which resources go into the language-dependent (MUI) .RES file. This option, and the information provided in the RC Configuration file, override the command line options /j and /k.

Windows Server 2003 and Windows XP/2000: This option is not available without also using the LoadMUILibrary and FreeMUILibrary functions on an updated system.

/r

Ignored. Provided for compatibility with existing makefiles.

/u

Undefines a symbol for the preprocessor.

/v

Displays messages that report on the progress of the compiler.

/x

Prevents RC from checking the INCLUDE environment variable when searching for header files or resource files.

Remarks

Options are not case sensitive, and a hyphen (-) can be used in place of a slash mark (/). You can combine single-letter options if they do not require any additional parameters.

RC will not generate a MUI file in the following cases.

  • No localizable resources exist in the .rc file.
  • The only resource language id specified in the .rc file is neutral (0x0).
  • The .rc file has resources that are specified in more than one language. The exception is if the .rc file contains two languages, and one language is neutral (0x0), RC generates a MUI file.


RC.EXE, the Microsoft SDK Resource Compiler

RAD Studio
RC.EXE, the Microsoft SDK Resource Compiler
Differences Between BRCC32 and RC | See Also
Collapse All

RC is the command-line version of the standard Microsoft SDK resource compiler. It accepts a resource script file (.RC) as input and produces a resource object file (.RES) as output.

Both C++Builder 2009 and Delphi 2009 give you a choice of resource compilers. On the Project [image] Options [image] Resource Compiler dialog box, you can select either of the following:

  • BRCC32.exe, the CodeGear resource compiler
  • RC.exe, the Microsoft platform SDK Resource Compiler

RC supports Unicode characters in resource files and file names, as well as new Vista resource types such as icons with alpha channel.

The actual filename of the RC compiler in the RAD Studio environment is ERC.exe.

Differences Between BRCC32 and RC

If you choose to use RC, several differences between BRCC32 and RC need to be addressed in existing .RC files, as follows:

  • To use Windows types or constants with RC, you need to explicitly #include <winresrc.h> for both C++ and Delphi.
  • RC does not handle image data inline as BRCC32 does. To use an image with RC, you need to save the image and refer to the image inline.
  • RC handles line continution differently than BRCC32. The simplest change is to combine strings with embedded newlines (\n).
  • For RC, the order of command elements requires that all command options must come first, before the name of the resource file.
  • RC does not allow trailing commas after the string in a STRINGLIST.
  • RC treats strings as C-style strings. This means that you need to do either of the following:
    • Escape a single backslash (\) in filenames by using a double backslash (\\).
    • Use a forward slash (/) in place of a single backslash (\).
  • For RC, specifying #include <dirname> does not search the current directory. To search the current directory, use #include "dirname".
  • To embed a double-quote character in a string, use two consecutive double-quote characters ("") instead of using the backslash escape character.
  • RCDATA and byte values are handled differently. For example:
    • BRCC32 treats '11 aa 22 bb' as a string of bytes.
    • For RC, you would need to specify 0xaa11 0xbb22.

See Also

BRC32.EXE

Microsoft Resouce Compiler

Using RC Compiler to Build Resources

Compiling Resources with RC - From Digital Mars

Resource Compiler Options

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!


D:\Com_CHM\CHM Prgm API\RC Resource Compiler\______Collect\J2M_DOC_Info\weditres.rtf

WeditRes
A Resource editor "Voir Borland BC555"

Jacob Navia
Logiciels/Informatique
1993-2000
Mode of operation
Note: The ressource editor is now integrated into Wedit. Nothing that is here has changed, and the changes are noted in the text.
Weditres is a utility for :
  • Designing your dialog boxes under Windows
  • Generate the ‘C’ code that is necessary for them to run.

  • This two operations can be separated. You can use the resource editor for just drawing your resources, and you will take care of the programming sied, writing of the callback functions, etc. This is a possibility for instance, when you have already a mass of code that uses this approach, and you do not feel like modifying it to fit into the resource editor schema of things.
  • The different steps involved in the construction of a dialog box.
  • To use a dialog box you have to
  • Draw it. Weditres helps you by giving you a drag and drop interface. You just place the objects in their respective positions.
  • Generate the different files that containg information about it (Save it)
  • Compile and link the generated sources with your program.
  • Test it.

  • This manual will explain you this operations in detail. To give you an overview of the process, here we summarize all those steps.
  • Step 1. Drawing the dialog box. You drop the controls from the toolbar in the place they will occupy in the dialog box. This operation is explained in detail in the first chapter.
  • Step 2. Saving it. Weditres saves the information in a special type of files with the extension .wed. This file contains the information Weditres needs that is not contained in a normal windows ressource file. The windows information is saved in two files : the .dlg, and the .res. Those files contain information that allows Windows to display your dialog box at runtime. In addition to those, Weditres generates a .c and a .h source files. Those are linked with your program, and implement all the user interface characteristics at runtime, that you defined when drawing the dialog box.
  • Step 3. You compile and link the generated sources with the callback procedures for your dialog box.
  • Step 4. You test...

Example :
You make the dialog called IDD_MYDLG, in the project called ‘myprj’. If you do not change the default file names, you will obtain the following files :
myprj.dlg. This file contains the ascii description of the resources used, to be compiled using lcc-win32 resource compiler ‘lrc’.
myprj.res This file contains the binary description of the resources. This file can be directly used by the linker to add your resources into the executable. This saves you the compilation step.
myprj.h. This file contains the symbolic definitions of the symbols you used in the dialog, so that you can use them in your C programs.

The .rc files.
You can have many dialog boxes and other resources in your program. Since weditres only edits the dialog boxes, it is important, when you needed it, to organize things into an .rc file, that will contain all other resource files, and the descriptions of all resources not handled by weditres.
This file, for the above example would contain just the following lines :
#include <windows.h>
#include myprj.h
#include myprj.dlg
The first line is mandatory. All the ASCII descriptions of resources use the symbolic names defined in windows.h, instead of the raw numerical values.
The second one instructs the resource compiler to include the definitions you made when designing the dialog box. You gave a symbolic name to each element you want to access in your dialog box, so this file, that contains all of them, should be included too.
The third line, instructs the resource compiler to read the dialog definitions from the indicated file.
You can separate all your dialogs, and store each one of them in a spearate dialog box file and header if you wish. In that fashion, each editing project remains of reasonable size.
Or you can throw all your dialogs into one big file, so you avoid cluttering your directory with too many files. This is a matter of taste left to you.
Structure of the generated code.
Weditres generates a dialog box procedure in a c file. this procedure contains the actions to take when each of the windows messages that you have decided to handle arrives at your dialog.
The structure of this procedure is verey simple : it is just a big ‘switch’ statement, containing a case for each of the messages that interested you.
BOOL DialogDlgProc(HWND hwnd,UINT msg,UINT wParam,UINT lParam)
{
switch (msg) {
case WM_INITDIALOG :
. some code here to treat this message
 .
return (TRUE) ;
case WM_COMMAND :
. some code here to treat this message
 .
etc.
 }
return(HandleDefaultMessages(hwnd,msg,wParam,lParam)) ;
}
The unhandled messages go to the default dialog box procedure of weditres. This procedure is described later, and treats all messages and takes default actions for some. Its code is located in weditreslib.lib, that you should include in your project link libraries. The source code is available too, so you can modify it as you wish.
Normally, you are interested in taking some action when a message arrives, and this can’t be generated by weditres. It is your task. Here we meet the ‘callback’ functions.
Each of those callback functions will be called by the dialog procedure when a message for which you showed interest arrives. Those callback functions receive different parameters, that allow them to access to the other controls of the dialog, or to take any other action.
The last piece that is missing from this puzzle, is how do you start all this happening. This is very easy. You use the DialogBox, or the DialogBoxParams function, to associate a resource with a procedure that will handle the messages.
This is done using the DialogBox windows primitive :
The DialogBox function creates a modal dialog box from a dialog box template resource. DialogBox does not return control until the specified callback function terminates the modal dialog box by calling the EndDialog function. Its prototype looks like this :
int DialogBox(HANDLE hInstance,
LPCTSTR lpTemplate,
HWND hWndParent,
DLGPROC lpDialogFunc ) ;
hInstance Identifies an instance of the module whose executable file contains the dialog box template.
lpTemplate Identifies the dialog box template. This parameter is either the pointer to a null-terminated character string that specifies the name of the dialog box template or an integer value that specifies the resource identifier of the dialog box template. If the parameter specifies a resource identifier, its high-order word must be zero and its low-order word must contain the identifier. You can use the MAKEINTRESOURCE macro to create this value.
Normally, all your resources are defined using a symbolic name, i.e. a #define that amounts to an integer. Weditres does not support named dialog boxes very well, and in any case, that is really wasteful of space in your executable.
hWndParent Identifies the window that owns the dialog box. Normally, this is the main window of your application, but of course you can use any other window.
lpDialogFunc Points to the dialog box procedure. For more information about the dialog box procedure, see the DialogProc callback function.
Return V alue If the function succeeds, the return value is the nResult parameter in the call to the EndDialog function used to terminate the dialog box.If the function fails, the return value is -1.
In the normal case you would just call then :
DialogBox(hInst,MAKEINTRESOURCE(IDD_MYDLG),hwndMain,MyDlgFunc) ;
The system loads the indicated resource dialog from the executable, and starts sending it messages. The first message, that its sent is WM_INITDLG, followed by a WM_SIZE. This messages are received when the dialog box is not yet visible in the screen. Here you can initialize things.
The function ‘MyDlgFunc’ is generated by weditres, and it starts receiving those messages. When a message that you marked as interesting arrives, the procedure that you indicated in the ‘Callbacks’ field of the control/dialog will receive control, and you can treat the message as you wish.
Building the dialog box.
The principle of operation for building the dialogs is simple : You have a toolbar with all the controls supported by weditres. You pick up one type of control (a button, a group box, etc) and you drop it at the position you want, within the surface of the dialog box.
You access to the parameters of the selected control by typing Ctrl+Y, or just double clicking in the surface of the control. Personally, typing Ctrl+Y is better, because a double click could slightly move the control from its position.
There is a different dialog box for each type of control. In those dialog boxes you define the identity (symbolic #define) and numerical value that you want for each control. This is not necessary for all controls, only for those you want to access from your program. Of course you could write
GetDlgItem(hwnd,476) ;
but it is much clearer if you write
GetDlgItem(hwnd,IDVALIDATE_BUTTON) ;

In the parameters dialog boxes you determine in general the following things :
The identity of the control, as shown above.You can change the symbolic name given by default, or its numeric value. To use an already existing identifier you open the identity combo box, and select an item from the list of available identifiers. Do not type an old name directly, because of a small bug I haven’t foudnd the time to correct. Only type a name in there when its a new name, not used before.
The static style of the control, i.e. the different options that windows gives for modifying the appearence of the control, or some other properties.
The dynamic style. This is implemented by C code generated by weditres, that allows you to change some characteristics of the dynamic behaviour or appearence that waren’t provided by the windows system.
The messages and actions you want to be aware of. Weditres will intercept the messages you indicate, and generate code that will code the function you specify. That function is usually indicated in a ‘Callbacks’ edit field, in each dialog box. You can type any name you want, but it is better to prefix it with the name of the dialog box, so that there isn’t any name conflict between the functions that make similar actions in different dialog boxes.

A simple example
You go into the ‘File’ option of the menu, choose new, enter ‘example’ as the name of the project, and then OK.
Weditres will startup a dialog box, and give you a complicated dialog box with several dozens of parameters. You ignore all of them except the ‘Callbacks’ field, and enter there the prefix for all the functions in this new dialog box : DlgExample.
Then, press the ‘ok’ button and the dialog box will disappear, leaving you an empty dialog box. Drag one button from the toolbar to the dialog box.
The ‘Button’ icon is labelled ‘ok’, so it is fairly easy to recognize it. If you leave the mouse a small time over each button, an explicative text appears, telling you what control is described by the icon.
Put the button somewhere in the dialog box, then double click on it. You will see a slightly less complicated dialog box open, and you will ignore all parameters, BUT the ‘Callbacks’ edit field. You will type in there : DlgExampleButtonAction.
Save your work. With an editor, open the file example.c, generated by weditres. You will see following code :

/* Wedit Res Info */
#include <windows.h>
#include « example.h »

BOOL APIENTRY DlgExample(HWND hwnd,UINT msg,
WPARAM wParam,LPARAM lParam) /* Standard paramaters of a callback function */
{
static WEDITDLGPARAMS WeditDlgParams ;
switch(msg) {
case WM_INITDIALOG : (1)
SetWindowLong(hwnd,DWL_USER,(DWORD)&WeditDlgParams) ;
DlgExampleInit(hwnd,wParam,lParam) ; (2)
/* store the input arguments if any */
SetProp(hwnd, »InputArgument »,(HANDLE)lParam) ;
break ;
case WM_COMMAND : (3)
switch (LOWORD(wParam)) {
case 101 :
DlgExampleButtonActionSelected(hwnd) ; (4)
break ;
}
break ;
}
return(HandleDefaultMessages(hwnd,msg,wParam,lParam)) ;
}
This message, is the first one that this procedure receives. Weditres does here some initializations, needed later for its internal workings. We ignore this.
The procedure ‘DlgExampleInit’, is called by the code generated by weditres. This procedure should initialize what needs to be initialized in this dialog box. This procedure should be written by YOU, since you are the one that knows what this dialog box will do, and what things need to be stored where.
The message WM_COMMAND is one of the most popular window messages. Most of the messages sent by the controls when an event occurs reach this part of the code.
DlgExampleButtonAction is again an example of a callback. This is a procedure that should be written by you, and should do whatever you think is necessary when the ‘action’ button is pushed.
The .dlg file
DLG_0100 DIALOG 6, 18, 180, 180 (1)
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU (2)
CAPTION « Dialog Title » (3)
FONT 8, « Helv » (4)
BEGIN
PUSHBUTTON « Push », 101, 52, 65, 40, 14 (5)
END
The dialog has the name DLG_0100 since we didn’t change the default name. You should put more meaningful names here. The coordinates in dialog box units follow.
The style of the dialog is the default style : visible, caption, system menu, and modal frame. This are the static styles.
The text of the caption follows.
The font name and point size follow.
We have only one control : a push button, with its default text. Again, the coordinates of the control follow in dialog box units.
A simple .rc file for our example
We can write a simple .rc file to be used with the resource compiler. Here it is :
#include <windows.h>
#include « example.h »
#include « example.dlg »
You can then compile this with the symple command line directive :
lrc example.rc
This is not necessary, since weditres generated too an example.res resource file that can be directly used by the linker.
Configuring the preferences
You can set the margins, and other things using the ‘Config’ menu item in the ‘Resources’ menu of Wedit.

The grid is the minimung spacing between each movement. The spacing is the amount of space left by the editor by default between controls. The margins, are just that : margins that delimit the controls from the borders of the window.
‘Sticky group boxes’ means that the controls that are enclosed by a group box are moved with the group box when you move it. If you deselect this feature, to move all items in a group box you have to select all of them.
You can include additional text in the header file that the resource editor generates. This text can be entered here.
Managing the selection
There is always a selected item. It is highlited with eight small red squares. You can change its hsape by taking one of the squares with the mouse, or, if you prefer using the Ctrl+Arrow keys : Ctrl+left arrow is equivalent to taking the square in the left border of the control and moving it leftwards.
To select several items, you click in the controls you want to select and maintain the Shift key pressed.
When several items are selected, you can align them using the dominant control as the guide. The dominant control has all its squares full, in contrast to the others, that have empty squares around them.
To align controls, use the fixed toolbar at the top of weditres. This toolbar contains bitmaps for aligning several controls in all possible positions.
You can use the clipboard to cut and paste dialog items from one dialog box to the other.
The clipboard works as always with the currently selected items.
Testing your dialog box.

To start the control, just press the ‘test’ button, or press Ctrl+T. This will make weditres create a copy of the control, and load that copy as windows would do. You can see the appearence of the control in action, press buttons, select list box items, etc. Pressing the OK button, or the Cancel button will stop the test. If the dialog box has a close menu, pressing that button will stop the test too.
If you have painted yourself in a corner, by drawing a dialog box without all those buttons, you can always get out by pressing Ctrl+T again, what will stop the test.
Using the directory listing
When you press the ‘dir’ button, you will see a list of all the dialog boxes that are contained in the current project in a separate window. Using the right mouse button, you can sort the items in several ways : by ID, or by title or others.
Setting the tab order.
The tab key can be used to switch the focus from one element of the list box to the following one in the Group order that you choose at design time. Normally, this order is the sequence that you used when dropping the controls in the dialog surface one after the other. You can change this order by using the ‘Group’ item in the ‘Options’ menu bar.
This order is important for the ergonomy of your dialog box, specially for people that do not like to leave the hands from the keyboard, and prefer just using the tab key to go to the next entry field for instance, instead of using lengthy mouse move operations.
The ‘Group’ dialog box will show you the list of controls that you have already dropped in your dialog box. You select one item, and then you can easily move it around to put it first or after another control. Here you can set/unset whether the control will be a tab stop or not. If you unset the tabs, the tab key will never go into that control. This is recommended for controls that do not accept any user input, like static text fields or group boxes.
And this is all there is to it Of course, there are hundreds of details that will be explained later,if I arrive at bringing myself to writing all the documentation... But the essential of weditres is this.
Controlling which files get generated.
To control which files will be generated, and where they will be written, you should use the ‘Files’ menu item in the ‘Files config’ contextual menu. This menu can be shown at any time if you press the right mouse button somewhere in the surface of the weditres edit window.

The dialog box that appears allows you to individually select/deselect which files will be generated, and to change the paths where they will be generated. It is not a bad idea to look at this place if you have any problems with paths, or similar.
The options are the following:
The framework file. This is a C source file that is generated by the resource editor that contains a dialog box procedure for each dialog box defined. Only if this option is active you will see in all properties dialog boxes the corresponding dynamic options.
The header file. This file should be always generated since it contains all the definitions of the integer constants in your resources.
The binary resource file. This is a file that can be passed directly to the linker.
The .rc ascii definitions file. This file will be generated if you started the resource editor with a .rc file. It contains the definitions of all the resources.
The .dlg file. This is an ascii file that contains the resources definitions for your dialog boxes only.
The .wed file contains the definitions of the dynamic properties of the dialog boxes or resource that you have designed.
User callbacks file. The name of the file where you stored the procedures that are going to be called from the dialog box procedures. This is optional.
Additional include files. Files that will be included too in your resource files. You can leave this field empty.
Dictionary. This is not implemented fully yet.
Include files for bitmaps etc. The resource editor will start the resource compiler telling it to include these directories in the search.

Group order

T
he group and the tab order are essential for a good user interface. The tab order is the sequence that the focus of the controls in the dialog will follow when the user presses the TAB key. Normally, the TAB key should go from one control to its immediate neighbor, without jumping around.
The dialog editor will establish this sequence as just the order that you used to drop the controls in the dialog. It often happens, however, that you drop a control, and then you realize that you forgot one, and drop another control in a wholly unrelated place. This doesn’t affect your dialog box visually, but it does affect the user interface. Pressing the TAB key will make the focus jump around within the controls of your dialog box.
Besides, it is important, that static controls like group boxes or text fields aren’t available with the TAB key. If they acquire the focus, they do not show it, so the user doesn’t know where the focus is.
You can change the tab order by moving the controls around within this dialog box. To move a control you select it first, by clicking in the middle of a row.
When a control is selected, you will see that the form of the mouse changes to an horizontal bar when moving within the list of controls. This means that you can drop the control in that position, and change its order.
The controls that are reachable with the TAB key have a small tab symbol at the left of them.
You should remove that tab stop from Group boxes, static text fields, and other static controls. You should add it to all controls that receive user input like buttons, edit fields, list boxes, etc.
You can set/unset this property with the corresponding buttons at the right side of the controls list.
You can set the ‘GROUP’ property to any control, that will become a group separator for a number of controls that are logically related.
T
he toolbar
Th
e floating toolbar of the editor allows you to choose a control and to drop it into the dialog box.

The different buttons are :

T
h
is cancels the selection.

T
h
is represents a static text control.

T
h
is represents an edit control, both single line (default) or a multiline edit control.

T
h
is represents a group box.

T
h
is represents a push button.

T
h
is represents a check box.

T
h
is represents a radio button.

T
h
is represents a combo box.

T
h
is represents a list box.

T
h
is two buttons represent a scroll control, either horizontal or vertical.
T
his two buttons represent a static rectangle, either empty or filled.
T
his represents an icon control.
T
his represents a month calendar control.
T
his represents a list view control. If you use this, please do not forget to call InitCommonControls in your code. This applies to all other controls after this one.

This represents a tab control.
T
his represents a tree view control.

T
h
is represent a progress control.

T
h
is represents a spin button.

T
h
is represents a slider control.

T
h
is represents an AVI displaying control. This is not operational in this version of weditres.
The two comboboxes allow you to edit the symbolic name of the currently selected control at the left, and to edit the control’s text at the right, if applicable.

Th
e selection
T
h
e selected control will be shown with full red handles around it. By holding the Shift key down and clicking in other controls, you can select several of them :
He
re we have four controls selected. The dominant control has the full red handles. The others are the controls that will be resized or aligned using the dominant control as the guide, and are shown with hollow red handles. For instance, if you select several controls and then press the align left button in the fixed toolbar of the editor, the controls will be aligned using the left side of the dominant control. If you choose the ‘same width’ button in the fixed toolbar, the dominant control’s width will be used to resize all other controls in the selection.
The multiple selection doesn’t apply to the dialog box itself of course, since there is no meaningful alignment that can be used with the dialog box itself.
The selection is important when copying controls from one dialog box to the other, since the normal operations like cut, paste, and copy apply to the selected controls. This allows you to easily transport controls from one dialog to another.
The arrow keys apply to the selection too : you can move the group of selected controls using the arrows, what is more precise than using the mouse.
When there is only one control selected, you can resize the selected control using the Ctrl+arrow keys. The combination Ctrl+left arrow, for instance, will maintain fixed the right side of the control, and resize it towards the left. The right arrow with the control key does the same but to the right, the up arrow resizes it towards the top of the screen, and the down arrow towards the bottom of the screen.
Fi
xing a control in the screen
Us
ing the tool, you can fix a control, or one side of a control to the screen. This allows you to move it horizontally or vertically without fear of disturbing the overall position, or to fix it in one place within the dialog box, so that you do not move accidentally later.
When you click in the tool, the mouse changes its shape, signifying that you can fix the selected control. This will not work when you have the entire dialog box selected, since fixing a dialog box is not very sinful.
You should click in one of the red handles of the selected control. The color of the handle will change, telling you that side of the control is now fixed. For instance :
will change to : , meaning the right side of the control is now fixed. This means that the control will move along the vertical axis only. This allows you to move this control easily with the mouse without fear that you move it to the left or right.
To exit from the ‘fixing’ mode, just click anywhere far away from the selected control in the screen.
To unfix a fixed control you just select the fixing tool again, and click in a blue handle. This acts as a toggle, unfixing the control.
Th
e status bar

The status bar is divided into five fields. They show in dialog coordinates :
Th
e upper left corner of the selected control(s).
The lower right corner of the selected control(s).
The width (dx).
The height (dy).
The id of the control.

Y
o
u can use the status bar to fine tune the position. By double clicking in the corresponding field of the status bar you can enter the positions numerically. When you double click in the ‘dx’ field of the status bar, you can change the width of the selected control and enter a numerical value directly.
Ma
naging the symbols

Th
e purpose of this dialog is to allow you to add a new symbol, to erase a definition you no longuer need, or to change either the name or the value of a symbol.
To add a new symbol type its name in the first entry field, then the value it should have in the second, and press the Add button.
To
erase a symbol select one in the list and press the Erase button.
To
change a symbol change either its name or value, and then press the Change button.
Th
e changes you do will be effective only after you press the validate button.
Easy isn’t it ? No big science here.

The zoom utility
This allows you to see in more detail your dialog box. Just choose ‘zoom’ in the resources menu of Wedit, then click in the surface of the small window that appears. Then, without releasing the mouse button , move the mouse pointer around. You will see the magnified contents of the rectangle that the mouse draws in the zoom window.Properties of a dialog box
App
lications use dialog boxes to prompt for additional information for commands that require user input. Using a dialog box is the only recommended way for an application to retrieve the input.
Normally the dialog box is created, used, and destroyed. When the dialog box is visible, the main window of the program is inactive. This type of dialog boxes is called modal dialogs.
Many applications also use dialog boxes to display information or options while the user works in another window. For example, word processing applications often use a dialog box with a text-search command. While the application searches for the text, the dialog box remains on the screen. The user can then return to the dialog box and search for the same word again ; or the user can change the entry in the dialog box and search for a new word. Applications that use dialog boxes in this way typically create one when the user chooses a command and continue to display it for as long as the application runs or until the user explicitly closes the dialog box. This are the modeless dialog boxes.

Modal dialog boxes are simpler to manage than modeless dialog boxes because they are created, perform their task, and are destroyed by calling a single function.

No
t
e that if you are editing a .res file, and you haven’t defined a project for weditres, only a portion of this dialog will be visible.
Tit
le
Thi
s text will be shown in the title bar of the dialog. You can enter any text here.
Ide
ntity
The
#define under which this dialog box will be used in your application. This is the define you use when you call the DialogBox function. The numerical value is shown too, below. In the ‘Specific class’ entry, you can enter a specific class that you want to use for this dialog. This is normally left blank. In case you want to use another window class than the usual one, please be sure that your class is registered before invoking the dialog.
Fon
t
Name and size of the font used for this dialog.
Optional Gadgets
Button Style Effect
Title WS_CAPTION Shows a dialog box title
Min button WS_MINIMIZE Minimize control in titlebar
Max button WS_MAXIMIZE Maximize button in titlebar
System menu WS_SYSMENU System menu
Vertical/horizontal scroll WS_HSCROLL/WS_VSCROLL Scroll bars. Normally never used
Standard buttons
Thi
s allows you to add the standard button ‘OK’, ‘Cancel’, and ‘Help’ to the dialog box automatically.
Jus
t press the ones you want to be added.
Styles
Button Style Effect
Tool window WS_EX_TOOLWINDOW A tool window has a title bar that is shorter than a normal title bar, and the window title is drawn using a smaller font. A tool window does not appear in the task bar or in the window that appears when the user presses ALT+TAB.
Accept files WS_EX_ACCEPTFILES Specifies that a window created with this style accepts drag-and-drop files.
Clip siblings WS_CLIPSIBLINGS Clips child windows relative to each other ; that is, when a particular child window receives a paint message, the WS_CLIPSIBLINGS style clips all other overlapped child windows out of the region of the child window to be updated. (If WS_CLIPSIBLINGS is not given and child windows overlap, when you draw within the client area of a child window, it is possible to draw within the client area of a neighboring child window.) For use with the WS_CHILD style only.
Transparent WS_EX_TRANSPARENT Specifies that a window created with this style is to be transparent. That is, any windows that are beneath the window are not obscured by the window. A window created with this style receives WM_PAINT messages only after all sibling windows beneath it have been updated.
Center mouse DS_CENTERMOUSE Centers the mouse cursor in the dialog box.
Set foreground DS_SETFOREGROUND This style brings the dialog box to the foreground. Internally, Windows calls the SetForegroundWindow function for the dialog box.
Control DS_CONTROL Creates a dialog box that works well as a child window of another dialog box, much like a page in a property sheet. This style allows the user to tab among the control windows of a child dialog box, use its accelerator keys, and so on.
Absolute alignment DS_ABSALIGN Indicates that the coordinates of the dialog box are screen coordinates ; otherwise, Windows assumes they are client coordinates.
No idle msg. DS_NOIDLEMSG Suppresses WM_ENTERIDLE messages that Windows would otherwise send to the owner of the dialog box while the dialog box is displayed.
System modal DS_SYSMODAL Creates a system-modal dialog box. This style causes the dialog box to have the WS_EX_TOPMOST style, but otherwise has no effect on the dialog box or the behavior of other windows in the system when the dialog box is displayed.
Popup WS_POPUP Creates a dialog that has the WS_POPUP bit on. Normally this is the default.
Child WS_CHILD Creates a dialog that has the WS_CHILD window style. Normally this is not desired. The dialog box can’t leave the boundaries of its mother window.
No fail create DS_NOFAILCREATE Creates the dialog box even if errors occur ¾ for example, if a child window cannot be created or if the system cannot create a special data segment for an edit control.
Clip children WS_CLIPCHILDREN Avoids drawing in child windows
Local edit DS_LOCALEDIT Applies to 16-bit applications only. This style directs edit controls in the dialog box to allocate memory from the application’s data segment. Otherwise, edit controls allocate storage from a global memory object. Somehow this button has resisted the port from 16 bit weditres...
3D look DS_3DLOOK This style is required only by Win32-based applications compiled for versions of Windows earlier than Windows 95 or Windows NT 4.0. The system automatically applies the three-dimensional look to dialog boxes created by applications compiled for current versions of Windows.
Center DS_CENTER Centers the dialog box in the working area ; that is, the area not obscured by the tray.
Visible WS_VISIBLE Show the dialog when it starts
Context help DS_CONTEXTHELP Includes a question mark in the title bar of the dialog box. When the user clicks the question mark, the cursor changes to a question mark with a pointer. If the user then clicks a control in the dialog box, the control receives a WM_HELP message. The control should pass the message to the dialog procedure, which should call the WinHelp function using the HELP_WM_HELP command. The Help application displays a pop-up window that typically contains help for the control.Note that DS_CONTEXTHELP is just a placeholder. When the dialog box is created, the system checks for DS_CONTEXTHELP and, if it is there, adds WS_EX_CONTEXTHELP to the extended style of the dialog box. WS_EX_CONTEXTHELP cannot be used with the WS_MAXIMIZEBOX or WS_MINIMIZEBOX styles.
Disabled WS_DISABLED Creates a window that is disabled at startup.

Messages
Message Effect
Init Calls the specified callback function when the message WM_INITDLG is received. The name of the callback is DlgXXXInit(HWND hwnd, WPARAM wParam, LPARAM lParam) Normally, you should handle this message, since it allows you to initialize things in the dialog box before is displayed.
Cancel Calls the specified callback function when the user presses the ‘Cancel’ button. The name of the callback is : DlgXXXCancel
Close Calls the specified callback when the dialog receives the WM_CLOSE message. Its name is : DlgXXXClose.
All Instead of calling the default message handling function, it calls a callback : DlgXXXDefault(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) ; This is an escape hatch so that you can always treat a message the framework doesn’t consider.
Validation Calls DlgXXXValidate(HWND hwnd) when the user presses theOK button.

Properties of a Push button
The properties are described in the following dialog box :

The fields are:
Button Style Effect
Standard BS_PUSHBUTTON Creates a normal push button
Default BS_DEFPUSHBUTTON Creates a default push button
Owner draw BS_OWNERDRAW Creates an owner draw pushbutton
Transparent WS_EX_TRANSPARENT Transparent button
Bitmap Not implemented
Windows bitmap Not implemented
Visible WS_VISIBLE Button is shown at startup
Disabled WS_DISABLED Disabled at startup
Vert center of text Centers the text vertically rather than horizontally
Client edge WS_EX_CLIENTEDGE Client edge
Flat BS_FLAT A flat button
Multi line BS_MULTILINE Text will contain several lines
Group WS_GROUP Button introduces a group of controls
Tab stop WS_TABSTOP Button can be reached with the tab key
Static edge WS_EX_STATICEDGE Button with a style that signifies that it doesn’t accept user input. A strange style for a button…

Properties of an edit field
An ed
it field is selected and receives the input focus when a user clicks the mouse inside it or presses the TAB key. After it is selected, the edit control displays its text (if any) and a flashing caret that indicates the insertion point. The user can then enter text, move the insertion point, or select text to be moved or deleted by using the keyboard or the mouse.

N
ote
that if you are editing a .res file, and you haven’t defined a project for weditres, only a portion of this dialog will be visible.
You should establish here the general appearance of the edit field, and the prefix that will be used by weditres when generating the callbacks you want for this control. You can change the font, if you wish, the number of accepted characters, and set the initial contents of the edit field, if any.
Ident
ity
The #
define under which this edit field will be used in your application. This is the define you use when you call the GetDlgItem function for instance. The numerical value is shown too, below.
Text
alignment
Text
can be aligned from the left, centered, and from the right. Normally, use left alignment, other styles will provoke strange things when typing.
Style
s
Button Style Effect
Visible WS_VISIBLE The edit filed is visible when the dialog box is displayed
Disabled WS_DISABLED The edit field is disabled (grayed) when the dialog box is displayed. You can change the text in it with SetDlgItemText, but the edit field doesn’t respond to user input.
Client edge WS_EX_CLIENTEDGE Specifies that a window has a 3D look-that is, a border with a sunken edge
Group WS_GROUP Specifies the first control of a group of controls in which the user can move from one control to the next with the arrow keys. All controls defined with the WS_GROUP style after the first control belong to the same group. The next control with the WS_GROUP style ends the style group and starts the next group (that is, one group ends where the next begins).
Tab stop WS_TABSTOP Specifies a control that can receive the keyboard focus when the user presses the TAB key. Pressing the TAB key changes the keyboard focus to the next control with the WS_TABSTOP style.
Static edge WS_EX_STATICEDGE Creates a window with a three-dimensional border style intended to be used for items that do not accept user input.
Transparent WS_EX_TRANSPARENT Specifies that a window created with this style is to be transparent. That is, any windows that are beneath the window are not obscured by the window. A window created with this style receives WM_PAINT messages only after all sibling windows beneath it have been updated.
Accept files WS_EX_ACCEPTFILES Specifies that a window created with this style accepts drag-and-drop files.
Number ES_NUMBER The edit field will only accept a positive number. A wrong character provokes a beep.
Read only ES_READONLY Prevents the user from typing or editing text in the edit control.
Vertical scroll WS_VSCROLL Vertical scrollbar. This is only allowed in multi line edit fields
Horizontal scroll WS_HSCROLL Horizontal scrollbar. This is only allowed in multiline edit fields.
Border WS_BORDER The edit field has a black border line around it.
Uppercase ES_UPPERCASE Converts the characters to uppercase as they are typed in.
Lowercase ES_LOWERCASE Converts the characters to lowercase as they are typed in.
Password ES_PASSWORD Doesn’t display the characters typed in.
Visible selection ES_NOHIDESEL Negates the default behavior for an edit control. The default behavior hides the selection when the control loses the input focus and inverts the selection when the control receives the input focus. If you specify ES_NOHIDESEL, the selected text is inverted, even if the control does not have the focus.
Horizontal scroll WS_HSCROLL Has a horizontal scroll
Want Car. return ES_WANTRETURN Specifies that a carriage return be inserted when the user presses the ENTER key while entering text into a multiline edit control in a dialog box. If you do not specify this style, pressing the ENTER key has the same effect as pressing the dialog box’s default push button. This style has no effect on a single-line edit control.
Auto hor. scroll Automatically scrolls text to the right by 10 characters when the user types a character at the end of the line. When the user presses the ENTER key, the control scrolls all text back to position zero.
Translate PC char set. ES_OEMCHARSET Converts text entered in the edit control. The text is converted from the Windows character set to the OEM character set and then back to the Windows set. This ensures proper character conversion when the application calls the CharToOem function to convert a Windows string in the edit control to OEM characters. This style is most useful for edit controls that contain filenames.
Multi-line ES_MULTILINE Designates a multiline edit control. The default is single-line edit control. When the multiline edit control is in a dialog box, the default response to pressing the ENTER key is to activate the default button. To use the ENTER key as a carriage return, use the ES_WANTRETURN style. When the multiline edit control is not in a dialog box and the ES_AUTOVSCROLL style is specified, the edit control shows as many lines as possible and scrolls vertically when the user presses the ENTER key. If you do not specify ES_AUTOVSCROLL, the edit control shows as many lines as possible and beeps if the user presses the ENTER key when no more lines can be displayed. If you specify the ES_AUTOHSCROLL style, the multiline edit control automatically scrolls horizontally when the caret goes past the right edge of the control. To start a new line, the user must press the ENTER key. If you do not specify ES_AUTOHSCROLL, the control automatically wraps words to the beginning of the next line when necessary. A new line is also started if the user presses the ENTER key. The window size determines the position of the word wrap. If the window size changes, the word wrapping position changes and the text is redisplayed. Multiline edit controls can have scroll bars. An edit control with scroll bars processes its own scroll bar messages. Note that edit controls without scroll bars scroll as described in the previous paragraphs and process any scroll messages sent by the parent window.

Messages
Message Effect
Set focus When the dialog box receives the EN_SETFOCUS message, the callback : DlgBoxXXXSetFocus(HWND hwnd, WPARAM wParam,LPARAM lParam) ; will be called.
Kill focus When the dialog box receives the EN_KILLFOCUS message the callback : DlgBoxXXXEditFieldYYYKillFocus(HWND hwnd, WPARAM wParam,LPARAM lParam) ; will be called. Normally at this point you would check the contents of the dialog box for validity. It is sometimes better to do it immediately, without waiting for the user closing the dialog box.
Text has changed When the dialog box receives the EN_CHANGE message from the control, the callback : DlgBoxXXXEditFieldYYYChanged(HWND hwnd, WPARAM wParam,LPARAM lParam) ; will be called. This allows you to follow the input character by character if you want it to.
Space Overflow If the user has typed so much text that the edit field has no space for holding it, the message EN_ERRSPACE will be received. At this point, if you want it, the callback : DlgBoxXXXEditFieldYYYErrSpace(HWND hwnd, WPARAM wParam,LPARAM lParam) ; will be called. This allows you to react to that situation. It must be noted that this was very frequent under windows 3.1, but it is virtually impossible that this happens now.
Horz Scroll If the user has clicked in the horizontal scroll, the dialog box will receive the EN_HSCROLL notification message from the control. You can react to this event. In this case the callback : DlgBoxXXXEditFieldYYYHorzScroll(HWND hwnd, WPARAM wParam,LPARAM lParam) ; will be called.
Vert Scroll If the user has clicked in the horizontal scroll, the dialog box will receive the EN_VSCROLL notification message from the control. You can react to this event. In this case the callback : DlgBoxXXXEditFieldYYYVertScroll(HWND hwnd, WPARAM wParam,LPARAM lParam) ; will be called.
Max text overflow This allows you to get called when the user types more text than the limit for the control. You can set this limit in the ‘Max. accepted chars’ field at the right of the properties dialog box. The callback has the form : DlgBoxXXXEditFieldYYYTextOverflow(HWND hwnd, WPARAM wParam,LPARAM lParam) ; will be called.
Init You can get called at the initialization of the dialog box, to initialize things for this specific control. Normally this is not used. The callback has the form : DlgBoxXXXEditFieldYYYInit(HWND hwnd, WPARAM wParam,LPARAM lParam) ;
Validate You can establish a callback specific for this control when the user presses the OK button. Normally this is not used, and you process all controls in the Validate message for the whole dialog box. DlgBoxXXXEditFieldYYYValidate(HWND hwnd, WPARAM wParam,LPARAM lParam) ; Note that the HWND parameter there is the hwnd of the edit field.

Radio button styles
A radi
o button consists of a round button and application-defined text, an icon, or a bitmap that indicates a choice the user can make by selecting the button. An application uses radio buttons in a group box to permit the user to choose from a set of related, but mutually exclusive options. For example, the application might present a group of radio buttons from which the user can select a format preference for text selected in the client area. The user could select a left-aligned, right-aligned, or centered format by selecting the corresponding radio button. Normally, the user can select only one option at a time from a set of radio buttons.

Note
t
hat if you are editing a .res file, and you haven’t defined a project for weditres, only a portion of this dialog will be visible.
You should specify the prefix to be used for this control, and the font to be used.
Text
T
his t
ext will be shown in the radio button. You can enter any text here.
Identi
ty
The #d
efine under which this radio button will be used in your application. The numerical value is shown too, below.
Font
N
ame a
nd size of the font used for this radio button.
Messag
es
Only t
wo messages need to be handled: Th ‘Init’ message, if you want a specific callback to be called at the initialization of the dialog box, and the ‘Click’ message, when the radio button has been activated. This message is not received when the radio button is deactivated, only when the transition is to the ‘on’ state. The callback is of the form:
DlgBox
XXXRadioBtnCliked(HWND hwnd, WPARAM wParam, LPARAM lParam) ;
Styles
Button text Style Effect
Auto BS_AUTORADIOBUTTON Creates a button that is the same as a radio button, except that when the user selects it, Windows automatically sets the button’s check state to checked and automatically sets the check state for all other buttons in the same group to unchecked.
left text BS_LEFTTEXT Places text on the left side of the radio button or check box when combined with a radio button or check box style.
Flat BS_FLAT The 3D appearence of the button is more flattened than a normal push button, but very similar. For an example see the radio buttons Init or Click in the dialog box at the beginning of this chapter.
Visible WS_VISIBLE The radio button is visible at startup.
Disabled WS_DISABLED The radio button is disabled at startup.
Multi line BS_MULTILINE The text of the radio button can be wrapped into several lines of text.
Client edge WS_EX_CLIENTEDGE Specifies that a window has a 3D look-that is, a border with a sunken edge
Static edge WS_EX_STATICEDGE Creates a window with a three-dimensional border style intended to be used for items that do not accept user input.
Push like The look of the radio button is very similar to a push button. It remains sunken when selected.
Tab stop WS_TABSTOP The Tab key can be used to move into the control
Help ID The button can answer the WM_HELP message. Not supported in this version.
Transparent WS_EX_TRANSPARENT The button is transparent. Not really a good idea but who knows ? Maybe you find a use for it.
Notify BS_NOTIFY Enables a button to send BN_DBLCLK, BN_KILLFOCUS, and BN_SETFOCUS notification messages to its parent window. Note that buttons send the BN_CLICKED notification message regardless of whether it has this style. Note that weditres doesn’t handle this messages, so you should process them yourself within your default dialog box procedure.
Bitmap The radio button holds a bitmap. Not supported in this version.
Icon The radio button holds an icon.. Not suypported yet.
Group WS_GROUP The radio button is a group separator. Not a good idea for a radio button that should be a member of a group of radio buttons.

Static text styles

A text
static control displays text in a rectangle in one of five styles: left-aligned without word-wrap, left aligned with word-wrap, centered, right-aligned, or « simple. »

Note
t
h
at if you are editing a .res file, and you haven’t defined a project for weditres, only a portion of this dialog will be visible.
Text
Th
is text will be shown in the text field. You can enter any text here.
Identity
The #de
fine under which this control will be used in your application. The numerical value is shown too, below.
Font
Na
me and size of the font used for this control.
Styles
Button text Style Effect
Left SS_LEFT Text left aligned
Center SS_CENTER Text centered
Right SS_RIGHT Text right aligned
Simple SS_SIMPLE Specifies a simple rectangle and displays a single line of left-aligned text in the rectangle. The text line cannot be shortened or altered in any way. The control’s parent window or dialog box must not process the WM_CTLCOLORSTATIC message.
One line SS_LEFTNOWORDWRAP Specifies a simple rectangle and left-aligns the given text in the rectangle. Tabs are expanded but words are not wrapped. Text that extends past the end of a line is clipped.
User item Obsolete Not longuer supported under windows 32.
Visible WS_VISIBLE Text is visible at startup.
Disabled WS_DISABLED Disabled at startup
No prefix SS_NOPREFIX Prevents interpretation of any ampersand (&) characters in the control’s text as accelerator prefix characters. These are displayed with the ampersand removed and the next character in the string underlined. This static control style may be included with any of the defined static controls.
Border WS_BORDER The text field has a visible border.
Client edge WS_EX_CLIENTEDGE Specifies that a window has a 3D look-that is, a border with a sunken edge
Group WS_GROUP The text field signals a group of controls.
Tab stop WS_TABSTOP The text field can be reached with the tab key. Normally this is not really good for a static control.
Sunken SS_SUNKEN The text has a sunken appearence
Help ID Not yet supported by weditres
Static edge WS_EX_STATICEDGE Static edge around the text

When yo
u press the color button, at the bottom right of the text styles dialog box, the standard dialog box for choosing a color will appear.
Weditres will generate code to handle the WM_CTLCOLORSTATIC message that will be received by the dialog box procedure. This code will set the color of the static text to the color you choose in the colors dialog box.
Propert
ies of a ComboBox
A combo
box consists of a list and a selection field. The list presents the options a user can select and the selection field displays the current selection. Except in drop-down list boxes, the selection field is an edit control and can be used to enter text not in the list.

Note t
h
a
t if you are editing a .res file, and you haven’t defined a project for weditres, only a portion of this dialog will be visible.
Text
Thi
s tex
t will be shown in the text field. You can enter any text here.
Identity

The #def
ine under which this combo box will be used in your application. The numerical value is shown too, below.
Font
Nam
e and
size of the font used for this combo box.
Styles
B
utton label Style Effect
List always visible CBS_SIMPLE Displays the list box at all times. The current selection in the list box is displayed in the edit control.
List+entry field CBS_DROPDOWN The user can select an item from the list or enter a new item in an antry field.
List only CBS_DROPDOWNLIST The user can only select an item from the list.
Visible WS_VISIBLE The control is visible at startup
Inactive WS_DISABLED The control is disabled at startup
Group WS_GROUP The control starts a new group of controls
Tab stop WS_TABSTOP The control can be reached with the Tab key.
Sort CBS_SORT Automatically sorts the strings in the list.
Optional scroll bar CBS_DISABLENOSCROLL Shows a disabled vertical scroll bar in the list box when the box does not contain enough items to scroll. Without this style, the scroll bar is hidden when the list box does not contain enough items.
Vertical scrollbar WS_VSCROLL List has a vertical scrollbar.
Exact height CBS_NOINTEGRALHEIGHT Specifies that the size of the combo box is exactly the size specified by the application when it created the combo box. Normally, Windows sizes a combo box so that it does not display partial items.
Local memory CBS_HASSTRINGS Specifies that an owner-drawn combo box contains items consisting of strings. The combo box maintains the memory and address for the strings, so the application can use the CB_GETLBTEXT message to retrieve the text for a particular item.
DOS character conversion. CBS_OEMCONVERT Converts text entered in the combo box edit control. The text is converted from the Windows character set to the DOS character set and then back to the Windows set. This ensures proper character conversion when the application calls the CharToOem function to convert a Windows string in the combo box to DOS characters. This style is most useful for combo boxes that contain filenames and applies only to combo boxes created with the CBS_SIMPLE or CBS_DROPDOWN style.
Owner draw fixed CBS_OWNERDRAWFIXED Specifies that the owner of the list box is responsible for drawing its contents and that the items in the list box are all the same height. The owner window receives a WM_MEASUREITEM message when the combo box is created and a WM_DRAWITEM message when a visual aspect of the combo box has changed.
Owner draw variable CBS_OWNERDRAWVARIABLE Specifies that the owner of the list box is responsible for drawing its contents and that the items in the list box are variable in height. The owner window receives a WM_MEASUREITEM message for each item in the combo box when you create the combo box ; the owner window receives a WM_DRAWITEM message when a visual aspect of the combo box has changed.
Automatic horz. scroll. CBS_AUTOHSCROLL Automatically scrolls the text in an edit control to the right when the user types a character at the end of the line. If this style is not set, only text that fits within the rectangular boundary is allowed
Client edge WS_EX_CLIENTEDGE Specifies that a window has a 3D look-that is, a border with a sunken edge
Static edge WS_EX_STATICEDGE Static edge around the text
Accept files WS_EX_ACCEPTFILES Specifies that a window created with this style accepts drag-and-drop files.
Right to left WS_EX_RIGHT Gives a window generic right-aligned properties. This depends on the window class.
Help ID Not supported yet
Transparent WS_EX_TRANSPARENT Not very useful for a combo box
Left scrollbar Displays the vertical scrollbar at the left
Modal frame WS_EX_DLGMODALFRAME Encloses the combo in a modal frame
Notify

Messages
Button Windows message Description
Init WM_INITDLG You can get called at the initialization of the dialog box, to initialize things for this specific control. Normally this is not used. The callback has the form : DlgXXXComboYYYInit(HWND hwnd, WPARAM wParam,LPARAM lParam) ;
Hiding list CBN_CLOSEUP This message is sent when the list box of a combo box has been closed.If you want to be notified when this message arrives, weditres will generate a callback of the form : DlgXXXComboYYYHideList(HWND hwnd,WPARAM wParam,LPARAM lParam) ;
Double click CBN_DBLCLK This message is sent when the user double-clicks a string in the list box of a combo box. If you want to take a special action here, weditres will generate a callback of the form : DlgXXXComboYYYDoubleClick(HWND hwnd,WPARAM wParam,LPARAM lParam) ;
Show list CBN_DROPDOWN This message is sent when the list box of a combo box is about to be made visible.If you want to take a special action, weditres will generate a callback of the form : DlgXXXComboYYYShowList(HWND hwnd,WPARAM wParam,LPARAM lParam) ;
Text update CBN_EDITUPDATE This message is sent when the edit control portion of a combo box is about to display altered text. This notification message is sent after the control has formatted the text, but before it displays the text. The generated callback has the form : DlgXXXComboYYYTextUpdate(HWND hwnd,WPARAM wParam,LPARAM lParam) ;
Text has changed CBN_EDITCHANGE This message is sent after the user has taken an action that may have altered the text in the edit control portion of a combo box. Unlike the CBN_EDITUPDATE notification message, this notification message is sent after Windows updates the screen. The callback has the form : DlgXXXComboYYYTextChange(HWND hwnd,WPARAM wParam,LPARAM lParam) ;
Selection cancel CBN_SELENDCANCEL This message is sent when the user selects an item, but then selects another control or closes the dialog box. It indicates the user’s initial selection is to be ignored. The callback has the form : DlgXXXComboYYYSelCancel(HWND hwnd,WPARAM wParam,LPARAM lParam) ;
No more memory CBN_ERRSPACE This message is sent when a combo box cannot allocate enough memory to meet a specific request. The generated callback has the form : DlgXXXComboYYYErrSpace(HWND hwnd,WPARAM wParam,LPARAM lParam) ;
Get focus CBN_SETFOCUS This message is sent when a combo box receives the keyboard focus. The generated callback has the form : DlgXXXComboYYYSetFocus(HWND hwnd,WPARAM wParam,LPARAM lParam) ;
Kill focus CBN_KILLFOCUS This message is sent when a combo box looses the keyboard focus. The generated callback has the form : DlgXXXComboYYYKillFocus(HWND hwnd,WPARAM wParam,LPARAM lParam) ;
Sel changed CBN_SELCHANGE This message is sent when the selection in the list box of a combo box is about to be changed as a result of the user either clicking in the list box or changing the selection by using the arrow keys. The callback generated has the form : DlgXXXComboYYYSelChange(HWND hwnd,WPARAM wParam,LPARAM lParam) ;
Sel validate CBN_SELENDOK This message is sent when the user selects a list item, or selects an item and then closes the list. It indicates that the user’s selection is to be processed. The callback has the form : DlgXXXComboYYYSelValidate(HWND hwnd,WPARAM wParam,LPARAM lParam) ;

Properties of a List Box
List box
items can be represented by text strings, bitmaps, or both. If the list box is not large enough to display all the list box items at once, the list box can provide a scroll bar. The user maneuvers through the list box items, scrolling the list when necessary, and selects or removes the selection from items. Selecting a list box item changes its visual appearance, usually by changing the text and background colors to the colors specified by the operating system metrics for selected items. When the user selects an item or removes the selection from an item, Windows sends a notification message to the parent window of the list box.

Note th
at
if you are editing a .res file, and you haven’t defined a project for weditres, only a portion of this dialog will be visible.
Identity
The #defi
ne under which this list box will be used in your application. This is the define you use when you access the control from your program. The numerical value is shown too, below.
Font
Name
and size of the font used for this list box.
Styles
Button Style Effect
Standard LBS_STADARD Sorts strings in the list box alphabetically. The parent window receives an input message whenever the user clicks or double-clicks a string. The list box has borders on all sides.
Border WS_BORDER Has a border around it.
Sort LBS_SORT Sorts strings in the list box alphabetically.
Notify LBS_NOTIFY Notifies the parent window with an input message whenever the user clicks or double-clicks a string in the list box.
Vert. Scroll WS_VSCROLL Has a vertical scroll (default)
Horz scroll WS_HSCROLL Has a horizontal scroll
Use tab tops LBS_USETABSTOPS Enables a list box to recognize and expand tab characters when drawing its strings. The default tab positions are 32 dialog box units. A dialog box unit is a horizontal or vertical distance. One horizontal dialog box unit is equal to 0.25 of the current dialog box base-width unit. Windows calculates these units based on the height and width of the current system font. The GetDialogBaseUnits function returns the current dialog box base units in pixels.
No redraw LBS_NOREDRAW Specifies that the list box’s appearance is not updated when changes are made. You can change this style by sending a WM_SETREDRAW message at any time.
Disable no scroll LBS_DISABLENOSCROLL Shows a disabled vertical scroll bar for the list box when the box does not contain enough items to scroll. If you do not specify this style, the scroll bar is hidden when the list box does not contain enough items.
No integral height LBS_NOINTEGRALHEIGHT Specifies that the size of the list box is exactly the size specified by the application when it created the list box. Normally, Windows sizes a list box so that the list box does not display partial items.
Want keyb. input LBS_WANTKEYBOARDINPUT Specifies that the owner of the list box receives WM_VKEYTOITEM messages whenever the user presses a key and the list box has the input focus. This enables an application to perform special processing on the keyboard input.
Owner draw fixed LBS_OWNERDRAWFIXED Specifies that the owner of the list box is responsible for drawing its contents and that the items in the list box are the same height. The owner window receives a WM_MEASUREITEM message when the list box is created and a WM_DRAWITEM message when a visual aspect of the list box has changed.
Owner draw variable LBS_OWNERDRAWVARIABLE Specifies that the owner of the list box is responsible for drawing its contents and that the items in the list box are variable in height. The owner window receives a WM_MEASUREITEM message for each item in the combo box when the combo box is created and a WM_DRAWITEM message when a visual aspect of the combo box has changed.
Has strings LBS_HASSTRINGS Specifies that a list box contains items consisting of strings. The list box maintains the memory and addresses for the strings so that the application can use the LB_GETTEXT message to retrieve the text for a particular item. By default, all list boxes except owner-drawn list boxes have this style. You can create an owner-drawn list box either with or without this style.
Multi column LBS_MULTICOLUMN Specifies a multicolumn list box that is scrolled horizontally. The LB_SETCOLUMNWIDTH message sets the width of the columns.
Multiple selection LBS_MULTISEL Turns string selection on or off each time the user clicks or double-clicks a string in the list box. The user can select any number of strings.
Extended selection LBS_EXTSEL Allows multiple items to be selected by using the SHIFT key and the mouse or special key combinations.
Help ID Not supported in this version
Visible WS_VISIBLE The list box is visible at startup
Disabled WS_DISABLED The list box is disabled at startup.
Group WS_GROUP The list box is the start of a new group of controls.
Tab stops WS_TABSTOP The list box can be reached with the tab key.
Static edge WS_EX_STATICEDGE Static edge around the control.
Transparent WS_EX_TRANSPARENT Transparent list box...
Client edge WS_EX_CLIENTEDGE Client edge around client area.
Modal frame List box has a modal frame around it. Not recommended.
Drag list box List box accepts dragging of items.
No selection LBS_NOSEL The list box doesn’t allow any selection.

Messages
Button Message Description
Init WM_INITDLG You can get called at the initialization of the dialog box, to initialize things for this specific control. Normally this is not used. The callback has the form : DlgXXXListYYYInit(HWND hwnd, WPARAM wParam,LPARAM lParam) ;
Get focus LBN_SETFOCUS This message is sent when the list box receives the keyboard focus. The generated callback has the form : DlgXXXListYYYSetFocus(HWND hwnd,WPARAM wParam,LPARAM lParam) ;
Double click LBN_DBLCLK This message is sent when the user has clicked in an item of the list box. The generated callback has the form : DlgXXXListYYYDoubleClick(HWND hwnd,WPARAM wParam,LPARAM lParam) ;
Selection changed LBN_SELCHANGE This message is sent when the selection in the list box changes. The generated callback has the form : DlgXXXListYYYSelChange(HWND hwnd,WPARAM wParam,LPARAM lParam) ;
Selection cancel LBN_SELCANCEL This message is sent when the user has cancelled the selection in the list box. The generated callback has the form : DlgXXXListYYYSetCancel(HWND hwnd,WPARAM wParam,LPARAM lParam) ;
Space overflow LBN_ERRSPACE This message is sent when the list box runs out of memory. The generated callback has the form : DlgXXXListYYYErrSpace(HWND hwnd,WPARAM wParam,LPARAM lParam) ;
Kill focus LBN_KILLFOCUS The message is sent when the list box looses the focus. The generated callback has the form : DlgXXXListYYYKillFocus(HWND hwnd,WPARAM wParam,LPARAM lParam) ;

Drag list box messages
Drag list boxes use the following structure.
Typedef struct {
UINT uNotification ;
HWND hWnd ;
POINT ptCursor ;
} DRAGLISTINFO, *LPDRAGLISTINFO ;

Members
uNotifica
tion Notification code that specifies the type of drag event. This member can be one of the following values :
Value Me
aning
DL_BEGINDRAG The user has clicked the left mouse button on a list item.
DL_CANCELDRAG The user has canceled the drag operation by clicking the right mouse button or pressing the ESC key.
DL_DRAGGING The user has moved the mouse while dragging an item.
DL_DROPPED The user has released the left mouse button, completing a drag operation.
hWnd Handle to drag list box.
ptCursor POINT structure that contains the current x- and y-coordinates of the mouse cursor
Here is a description of the callbacks generated by weditres for a list box drag operation.
Button Message Description
Begin drag DL_BEGINDRAG This message notifies the parent window of a drag list box that the user has clicked the left mouse button on a list item. The callback for this message is : long DlgXXXListYYYBeginDrag(HWND hwnd, DRAGLISTINFO * dlInfo) ; You should return either one (go on and start dragging) or zero (cancel the whole operation).
Cancel Drag DL_CANCELDRAG This message arrives if the user has canceled the drag operation. The callback has the form : long DlgXXXListYYYCancelDrag(HWND hwnd,DRAGLISTINFO * dlInfo) ; The return value is ignored.
Dragging DL_DRAGGING This message arrives continuosly as the user proceeds with the drag operation. The callback has the form : long DlgXXXListYYYDragging(HWND hwnd,DRAGLISTINFO *dlInfo) ; The return value determines the type of mouse cursor that the drag list should set ; it can be the DL_STOPCURSOR, DL_COPYCURSOR, or DL_MOVECURSOR value. If any other value is returned, the cursor does not change.
End Drag DL_DROPPED This message arrives when the user ends the drag operation. The callback has the form : long DlgXXXListYYYEndDrag(HWND hwnd,DRAGLISTINFO *dlInfo) ;

Normally you should set a callback to all the messages sent. It would be a bad programming practice to leave the problem of whether the user can start a drag operation for instance, to the default dialog box procedure that always returns zero. This would mean that the user could never start a drag operation...

Check box Styles
A check bo
x consists of a square box and application-defined text , an icon, or a bitmap that indicates a choice the user can make by selecting the button. Applications display check boxes in a group box to permit the user to choose from a set of related, but independent options.

Note tha
t
if you are editing a .res file, and you haven’t defined a project for weditres, only a portion of this dialog will be visible.
You should specify the prefix to be used for this control, and the font to be used.
Text
This
text
will be shown in the check box. You can enter any text here up to 255 chars.
Identity
T
he #defin
e under which this check box will be used in your application. This is the define you use when you call the IsDlgButtonChecked function for instance. The numerical value is shown too, below.
Font
Name
and s
ize of the font used for this check box.
Initial st
ate
If you che
ck this check box, weditres will generate a call to the windows API CheckDlgButton, to check the check button when initializing the dialog box.
Messages
T
he ‘Click
’ message is received when the check box has been activated. This message is not received when the check box is deactivated, only when the transition is to the ‘on’ state. The callback is of the form:
DlgBoxXXXC
heckBoxCliked(HWND hwnd, WPARAM wParam, LPARAM lParam) ;
Styles
Button text Style Effect
Automatic BS_AUTOCHECKBOX Creates a button that is the same as a check box, except that the check state automatically toggles between checked and unchecked each time the user selects the check box.
Three state BS_AUTO3STATE Creates a button that is the same as a three-state check box, except that the box changes its state when the user selects it. The state cycles through checked, grayed, and unchecked.
Left text BS_LEFT Places text on the left side of the check box
Visible WS_VISIBLE The check box is visible at startup.
Disabled WS_DISABLED The check box is disabled at startup.
Multi line BS_MULTILINE The text of the check box can be wrapped into several lines of text.
Client edge WS_EX_CLIENTEDGE Specifies that a window has a 3D look-that is, a border with a sunken edge
Static edge WS_EX_STATICEDGE Creates a window with a three-dimensional border style intended to be used for items that do not accept user input.
Push like The look of the check box is very similar to a push button. It remains sunken when selected.
Tab stop WS_TABSTOP The Tab key can be used to move into the control
Help ID The button can answer the WM_HELP message. Not supported in this version.
Transparent WS_EX_TRANSPARENT The button is transparent. Not really a good idea for an item that should receive user input...
Notify BS_NOTIFY Enables a button to send BN_DBLCLK, BN_KILLFOCUS, and BN_SETFOCUS notification messages to its parent window. Note that buttons send the BN_CLICKED notification message regardless of whether it has this style. Note that weditres doesn’t handle this messages, so you should process them yourself within your default dialog box procedure.
Group WS_GROUP The check box is a group separator.

Group box styles
A group box
is a rectangle that surrounds a set of controls, such as check boxes or radio buttons, with application-defined text (label) in its upper left corner. The sole purpose of a group box is to organize controls related by a common purpose (usually indicated by the label).

The style
s
of a group box are described in detail in the documentation of any of the other controls.
There are no callbacks, since the group box sends no messages, and receives no input.
You will notice that group boxes carry the elements that they contain in the editor, when you move them. Modifying the ‘sticky group boxes’ check box in the configuration of the editor can change this behavior.
White Recta
ngle styles

This cont
r
o
l, like the group box above, is just for grouping purposes. It receives no input and sends no messages.
Black recta
ngle styles

This cont
r
o
l, like the group box above, is just for grouping purposes. It receives no input and sends no messages.
Horizontal s
croll

Vertical s
c
roll styles

These cont
r
o
ls are seldom used by themselves in dialog boxes. They can send only one message: WM_HSCROLL or WM_VSCROLL.
Since there is only one message, no suffix will be added to the name of the control procedure as specified in the ‘Callbacks’ edit field. The procedure would be then :
void DlgXXXScrollYYY(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) ;
The message argumet can be either WM_VSCROLL or WM_HSCROLL. This way you can use a single callback procedure for both messages.
Spin control
styles
To the user,
a spin control and its buddy window often look like a single control. You can specify that an up-down control automatically position itself next to its buddy window and that it automatically set the caption of the buddy window to its current position. For example, you can use a spin control with an edit control to prompt the user for numeric input.
Spin controls are called up and down controls in the documentation from Microsoft. Thy existed before under windows 31 under the name of spin controls, and I didn’t feel like changing their name just because Microsoft decided a new name. Many of us implemented those under windows 3.1. This explains the UDS prefix for the spin control styles: Up Down Style.
Here is an example configuration:

The spin co
nt
rol is at the left of the entry field. Pressing the arrows you can increment/decrement the edit field contents.
The Identity and Value fields have the same meaning than in the other controls.
Styles

Sta
tic sty
l
es
Input field Window style Purpose
Visible WS_VISIBLE Makes the control visible at startup
Disabled WS_DISABLED Disables the control at startup
Group WS_GROUP Marks the start of a group of controls
Tab stop WS_TABSTOP Makes this control reachable with the TAB key.
Static edge WS_EX_STATICEDGE Has a static edge around it
Client edge WS_EX_CLIENTEDGE Has an edge around the client area
Help ID Not implemented in this version
Select buddy window automatically UDS_AUTOBUDDY Automatically selects the previous window in the Z order as the spin control’s buddy window. Please be sure that the window selected is a good one. For instance, if the Z order indicates a Group box, the spin control will attach itself to a group box, not a very useful thing... Use the <Group> menu option of weditres to select the right control.
No thousands UDS_NOTHOUSANDS Does not insert a thousands separator between every three decimal digits.
Set buddy integer UDS_SETBUDDYINT Causes the spin control to set the text of the buddy window (using the WM_SETTEXT message) when the position changes. The text consists of the position formatted as a decimal or hexadecimal string.
Wrap beyond selected rage UDS_WRAP Causes the position to « wrap » if it is incremented or decremented beyond the ending or beginning of the range.
Use keyboard arrow keys UDS_ARROWKEYS Causes the up-down control to increment and decrement the position when the UP ARROW and DOWN ARROW keys are pressed.
Unattached UDS_ALIGNNONE No alignment to the buddy window
Left aligned UDS_ALIGNLEFT Positions the spin control next to the left edge of the buddy window. The buddy window is moved to the right and its width decreased to accommodate the width of the spin control.
Right aligned UDS_ALIGNRIGHT Positions the spin control next to the right edge of the buddy window. The width of the buddy window is decreased to accommodate the width of the spin control.

Messages
Input field Window message Purpose
Value will change UDN_DELTAPOS The operating system sends the UDN_DELTAPOS notification message to the parent window of an spin control when the position of the control is about to change. This happens when the user requests a change in the value by pressing the control’s up or down arrow. The UDN_DELTAPOS message is sent before the WM_VSCROLL or WM_HSCROLL message that actually changes the control’s position. This lets you examine, allow, modify, or disallow the change. return TRUE in your callback in response to this message to prevent the change in the control’s position. Return FALSE to allow the change The callback will be of the form : int DlgXSpinYDeltaPos(HWND hwnd,PNMHDR pnmhdr) ;
Value has changed WM_HSCROLL or WM_VSCROLL This notifies you of the new value. The generated callback has the form : int DlgXXSpinYY(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) ; Since the message received is passed to the callback, you can diffrentiate between horizontal and vertical spin controls.
Range UDM_SETRANGE Sets the upper and lower range for the spin control.
The tree control

Here we hav
e
a dialog with a big tree control in it. This is a very complex control, that can do a lot of things but needs a lot of effort to get it right. Weditres can help you a bit by generating some of the code that needs to be written.
The properties box of the tree control matches this element’s complexity. Here it is:

Styles
Besi
de
s the n
ormal window styles like visible, client edge, etc etc, a tree control can have the following styles of its own :
Description S
tyle Purpose
Has lines to join items TVS_HASLINES Enhances the representation of the hierarchy by drawing lines that link child items to their parent item. This style does not link items at the root of the hierarchy.
Has lines at root position TVS_LINESATROOT When combined with the TVS_HASLINES style, this forces the tree control to draw lines at the root of the hierarchy.
Buttons to indicate item state TVS_HASBUTTONS The user can expand or collapse a parent item’s list of child items by double_clicking the parent item. A tree view control that has this style adds a button to the left of each parent item. The user can click the bitton once instead of double clicking the parent item to expand or collapse the child. Again, this styme does not add buttons at the root. You should specify the style TVS_LINESATROOT to get buttons at the root of the hierarchy.
Edit labels TVS_EDITLABELS This style makes it possible for the user to edit the labels of tree view items.
Show always the selected item TVS_SHOWSELALWAYS This style forces a selected item to remain selected when the control loses focus.
Disable drag and drop TVS_DISABLEDRAGANDROP This style disables the drag and drop feature.

Messages :
Description Message Purpose
Begin drag TVN_BEGINDRAG Notifies the program that the user has begun a drag operation with the left mouse. The callback function will be of the form : xxxBeginDrag(HWND,NM_TREEVIEW *) ;
Begin right button drag TVN_BEINRDRAG The user has begun a drag operation with the right mouse button. The callback will be of the form : xxxBeginRDrag(HWND,NM_TREEVIEW *) ;
Begin label editing TVN_BEGINLABELEDIT The user has begun to edit a tree label. The callback will be of the form : xxxBeginLabelEdit(HWND,TV_DISPINFO *) ;
End label editing TVN_ENDLABELEDIT The user has ended the editing of a label in an item. The callback will be of the form : xxxEndLabelEdit(HWND,TV_DISPINFO *) ;
Needs display information TVN_GETDISPINFO Requests information that the tree view control requires to display an item. The callback has the form : xxxGetDispInfo(HWND,TV_DISPINFO *) ;
Set display information TVN_SETDISPINFO Informs the parent window that it should set the display information it has about an item. The callback has the form : xxxSetDispInfo(HWND,TV_DISPINFO *) ;
Selection has changed TVN_SELCHANGED Informs the parent window that the selection has changed from one item to another. The callback has the form : xxxSelChanged(HWND,NM_TREEVIEW *) ;
Selection is changing TVN_SELCHANGING Informs the parent window that the selection is about to change. The callback as the form : xxxSelChanging(HWND,NM_TREEVIEW *) ;
Item is expanding TVN_ITEMEXPANDING Informs the parent window that an item is going to expand or collapse. The callback has the form : xxxItemExpanding(HWND,NM_TREEVIEW *) ;
Item has been expanded TVN_ITEMEXPANDED Informs the parent window that an item has been expanded. The callback has the form : xxxItemExpanded(HWND,NM_TREEVIEW *) ;
Key has been pressed TVN_KEYDOWN A keyboard event. The callback has the form : xxxKeyDown(HWND,TV_KEYDOWN *) ;
Return WM_NOTIFY The return key has been pressed. The callback has the form : xxxReturnPressed(HWND,NMHDR *) ;

The parameter
‘hwnd’ in all messages above is the handle of the dialog window. You can get the handle of the tree control by using the GetDlgItem primitive.
The structures used are the following:
1) NM_TREEVIE
W

Contains information about a tree view notification message.
typedef struct _NM_TREEVIEW {
NMHDR hdr ;
UINT action ;
TV_ITEM itemOld ;
TV_ITEM itemNew ;
POINT ptDrag ;
} NM_TREEVIEW ;
typedef NM_TREEVIEW *LPNM_TREEVIEW ;
Members description :
NMHDR hdr
Specifies an NMHDR structure. The code member of the NMHDR structure can one of the following notification codes that identify the message being sent : TVN_BEGINDRAG, TVN_BEGINRDRAG, TVN_DELETEITEM, TVN_ITEMEXPANDED, TVN_ITEMEXPANDING, TVN_SELCHANGED, TVN_SELCHANGING.
UINT action
Specifies a notification-specific action flag.
TV_ITEM itemOld
Specifies a TV_ITEM structure that contains information about the old item state. This member is zero for notification messages that do not use it.
TV_ITEM itemNew
Specifies a TV_ITEM structure that contains information about the new item state. This member is zero for notification messages that do not use it.
POINT ptDrag
Specifies a POINT structure that contains the client coordinates of the mouse at the time the event occurred that caused the notification message to be sent.
2) TV_ITEM
The TV_ITEM structure specifies or receives attributes of a tree-view item.
typedef struct _NM_TREEVIEW {
NMHDR hdr ;
UINT action ;
TV_ITEM itemOld ;
TV_ITEM itemNew ;
POINT ptDrag ;
} NM_TREEVIEW ;
Members description :
NMHDR hdr
Specifies an NMHDR structure. The code member of the NMHDR structure can one of the following notification codes that identify the message being sent : TVN_BEGINDRAG, TVN_BEGINRDRAG, TVN_DELETEITEM, TVN_ITEMEXPANDED, TVN_ITEMEXPANDING, TVN_SELCHANGED, TVN_SELCHANGING.
UINT action
Specifies a notification-specific action flag.
TV_ITEM itemOld
Specifies a TV_ITEM structure that contains information about the old item state. This member is zero for notification messages that do not use it.
itemNew
Specifies a TV_ITEM structure that contains information about the new item state. This member is zero for notification messages that do not use it.
ptDrag
Specifies a POINT structure that contains the client coordinates of the mouse at the time the event occurred that caused the notification message to be sent.
3) NMHDR
typedef struct tagNMHDR {
HWND hwndFrom ;
UINT idFrom ;
UINT code ;
} NMHDR ;
Members description :
hwndFrom
Handle to control sending message. In the above examples is the handle of the tree control.
idFrom
Identifier of control sending message. In the case above, this would be the id of the tree control.
code
Specifies the notification code.
4) TV_DISPINFO :
typedef struct _TV_DISPINFO { tvdi
NMHDR hdr ;
TV_ITEM item ;
} TV_DISPINFO ;
Handling the Begin/End drag.
Here is an example of a callback function that handles the begin drag message, adapted from the documentation of MSDN.
// MyTreeViewBeginDrag - begins dragging an item in a tree view control.
// hwndTV - handle to the image list.
// lpnmtv - address of information about the item being dragged.
void MyTreeViewBeginDrag(HWND hwndTV, LPNMTREEVIEW lpnmtv)
{
HIMAGELIST himl ; // handle to image list
RECT rcItem ; // bounding rectangle of item
DWORD dwLevel ; // heading level of item
DWORD dwIndent ; // amount that child items are indented

// Tell the tree view control to create an image to use for dragging.
himl = TreeView_CreateDragImage(hwndTV, lpnmtv->itemNew.hItem) ;
// Get the bounding rectangle of the item being dragged.
TreeView_GetItemRect(hwndTV, lpnmtv->itemNew.hItem, &rcItem, TRUE) ;
// Get the heading level and the amount that the child items are indented.
dwLevel = lpnmtv->itemNew.lParam ;
dwIndent = (DWORD) SendMessage(hwndTV, TVM_GETINDENT, 0, 0) ;
// Start the drag operation. This is not a function call, it is just a macro, defined in win.h
ImageList_BeginDrag(himl, 0, 0, 0) ;
// Hide the mouse cursor, and direct mouse input to the parent window.
ShowCursor(FALSE) ;
// Now capture the mouse to follow the drag operation.
SetCapture(GetParent(hwndTV)) ;
// Sets a global variable to notify the functions that are going to be called later when dragging is active.
g_fDragging = TRUE ;
return ;
}

OK, that is the start. What about later ?
You have sure
ly remarked that we have captured the mouse in that function above. To follow the item in its long journey we just follow the WM_MOUSEMOVE messages. To handle those messages you should check the ‘All’ check box in the properties dialog of the dialog box that contains the tree control, and handle the mouse move message like this :
// Dlg_MouseM
ove - drags an item in a tree view control,
// highlighting the item that is the target.
// hwndParent - handle to the parent window.
// hwndTV - handle to the tree view control.
// xCur and yCur - x- and y-coordinates of the mouse cursor.
void Dlg_MouseMove(HWND hwndParent, HWND hwndTV, LONG xCur, LONG yCur)
{
HTREEITEM htiTarget ; // handle to target item
TVHITTESTINFO tvht ; // hit test information
if (g_fDragging) { // the global flag that we have set above.
// Drag the item to the current position of the mouse cursor.
ImageList_DragMove(xCur, yCur) ;
// Find out if the cursor is on the item. If it is, highlight
// the item as a drop target.
tvht.pt.x = xCur ;
tvht.pt.y = yCur ;
if ((htiTarget = TreeView_HitTest(hwndTV, &tvht)) != NULL) {
TreeView_SelectDropTarget(hwndTV, htiTarget) ;
}
}
return ;
}
When the control arrives finally at the destination we do :
// Main_OnLButtonUp - stops dragging a tree view item, releases the
// mouse capture, and shows the mouse cursor. This is called when the
// dialog procedure receives the WM_LBUTTONUP message
// Global variable
// g_fDragging - indicates whether a drag operation is underway.
void DlgOnLButtonUp(void)
{
if (g_fDragging) {
ImageList_EndDrag() ;
ReleaseCapture() ;
ShowCursor(TRUE) ;
g_fDragging = FALSE ;
}
return ;
}
The slider control
This control allows you to input analog values in an easy to understand fashion. Here is a screen shot of different sliders with different attributes.
:

Sliders can
b
e drawn in vertical or horizontal position, with rounded or not pointers, with ticks above or below, etc.

To control t
he different options you use the following properties dialog box :

The slider
in
terfaces with the dialog box that contains it only with the WM_HSCROLL or the WM_VSCROLL message. Weditres will add code to handle those messages and call your callback procedure when the slider wants to say to you something.

You can add a range of values, and Weditres will generate code to set that range of values at run time during the initialization of the dialog box.
The other styles shown are the usual ones already explained in all the other controls (visible, tab stop, etc). They will not be repeated here.
The date cale
ndar control
This control
allows the user to choose a date. Here is an example.

The styles that you can choose for this control are displayed in the following dialog box:

Description S
tyle Purpose
Allow dynamic query of days to display in bold MCS_DAYSTATE The month calendar will send MCN_GETDAYSTATE notifications to request information about which days should be displayed in bold. For more information about supporting this style, see Processing the MCN_GETDAYSTATE Notification Message
Multiple day selection MCS_MULTISELECT The month calendar will allow the user to select a range of dates within the control. By default, the maximum range is one week. You can change the maximum range that can be selected by using the MCM_SETMAXSELCOUNT message.
Do not display the “today” line MCS_NOTODAY The month calendar control will not display the "today" date at the bottom of the control.
Do not display a circle around the selected day MCS_NOTODAYCIRCLE The month calendar control will not circle the "today" date.
Display the number of the week in the year MCS_WEEKNUMBERS The month calendar control will display week numbers (1-52) to the left of each row of days. Week 1 is defined as the first week that contains at least four days.

Processing t
h
e MCN_GETDAYSTATE Notification Message
Month calenda
r controls send the MCN_GETDAYSTATE notification message to request information about how the days within the visible months should be displayed. The following application-defined function, DoNotify, processes MCN_GETDAYSTATE by filling an array of MONTHDAYSTATE values to highlight the 15th day of each month.
DoNotify extracts the number of MONTHDAYSTATE values needed from the cDayState member of the NMDAYSTATE structure that lParam points to. It then loops to set the 15th bit in each element of the array, using the application-defined BOLDDAY macro.
BOOL WINAPI D
oNotify(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
#define BOLDDAY(ds,iDay) if(iDay>0 && iDay<32)\
(ds)|=(0x00000001<<(iDay-1))

#define lpnmDS ((NMDAYSTATE *)lParam)
#define MAX_MONTHS 12

MONTHDAYSTATE mds[MAX_MONTHS];
INT i, iMax;
LPNMHDR hdr = (LPNMHDR)lParam;

switch(hdr->code){
case MCN_GETDAYSTATE:
iMax=lpnmDS->cDayState;

for(i=0;i<iMax;i++){
mds[i] = (MONTHDAYSTATE)0;
BOLDDAY(mds[i],15);
}
lpnmDS->prgDayState = mds;
break;
}
return FALSE;
}
Preparing the MONTHDAYSTATE Array
Both the MCM_
SETDAYSTATE message and MCN_GETDAYSTATE notification message require an array of MONTHDAYSTATE values to determine how dates will be displayed. Each month that the control displays must have a corresponding element within the array.
To support these messages, your application must properly prepare the array. The following is a simple macro that sets a bit in a MONTHDAYSTATE value for a given day within that month.
#define BOLDD
AY(ds,iDay) if(iDay>0 && iDay<32)\
(ds)|=(0x00000001<<(iDay-1))
Using this ma
cro, an application could simply loop through an array of important dates, setting bits within the corresponding array elements. This approach is not the most efficient, of course, but works well for many purposes. As long as your application sets MONTHDAYSTATE bits appropriately, it does not matter how those bits were set.

Processing th
is message within the framework.
The framework
will not generate code for this message. You should setup a procedure that catches all messages for your window, and within that procedure, treat the answer to this message as indicated above. To setup such a procedure open the properties of the dialog box as a whole, and then check the “ALL” button in the messages you want to handle. This way, you will become all messages. Within that procedure you should handle the WM_NOTIFY message, where this notifications arrive.

The menu edit
or
The menu edit
or shows you the menu in the form of a tree. Each top level pop-up corresponds to the top level items of the menu being edited.

To add a menu item just type insert (the ‘ins’ key), selecting before the menu item above the one you will introduce.

You do the same for introducing a new menu item in a pop-up.

You can test your menu to see it in ‘action’ by choosing ‘test’ in the ‘File’ option of the main menu of the menu editor.

Besides the tree with the items, you will se the following dialog box floating around. Here you enter the name of the menu, its associated symbol (#define), and its value.

In the ‘Options’ group you can change the appearance of the menu item, either for a normal menu item, or for a popup menu. Do not forget to press ‘Apply’ when you are done with changes.

The string tab
le editor
This utility a
llows you to edit the string tables contained in your resource file. String tables are a resource kind for storing character strings in the resource section of the executable instead of using string literal in the program text itself.
The original motivation for this was the ever-growing need under windows 3.0 to have more memory with the space severely limited to 64K for the stack, all character strings, and all static data. This lead to trying to make more space in the data segment by putting the strings somewhere else, and loading /unloading them as needed.
But there are many other beneficial side effects, so the usage of string tables has stayed with us even in windows 98. One of the good side effects is the separation from message text from the code itself, so that if you need to translate the program into another language you do not need to edit the source files, but just the resource file, what is far easier for the person who is doing the translation, since he/she doesn’t have to be a programmer AND a foreign language expert, a rare combination.

The string e
di
tor presents a simple interface. You double click in a string to edit one, or you can add/delete strings, as you may esteem necessary.
The ‘Save’ button doesn’t save the modified resources to the disk immediately, but just writes it to the resource file in memory. It will get written to disk when you exit weditres.

The accelerato
r table editor
An accelerator
table is an association from keyboard keys combinations with a command item. This can be a menu command item, but this is not necessarily the case. When the user presses the defined keyboard keys combination (Ctrl+Shift+N, for example), the window procedure associated with the accelerator table will receive a WM_COMMAND message, containing the numerical value that you associated with this keyboard combination.

Fo instance, w
h
en you want that Ctrl+Shift+N do something special in your application, you define an accelerator key like

1) In your hea
der file:

#define MENU_STOPCALCULATING 3000

2) In your resource file:

"^N" MENU_STOPCALCULATING SHIFT CONTROL

3) In your window procedure:

switch(message) {
...
case WM_COMMAND:
switch(LOWORD(wParam)) {
case MENU_STOPCALCULATING:
if (CalculationsStarted()) {
StopCals();
}
break;
}
}

You can have a
menu item somewhere, with an item 'Stop calculations" but this is not mandatory. You receive from windows this message when you do not forget to add the TranslateMessage step in that famous MainLoop of your window procedure.

You can edit t
h
is table graphically from Weditres. To call the corresponding editor you should either use the menu item in the 'Objects' bar, or use the directory tree. There, (if there is already a resource table defined in the application), you will find your table. Just double click in its name and the accelerator editor will be called automatically.

The editor for
this resource type is very simple. It will show you at startup a list of all defined items. You can perform the usual actions (Add, Modify, and Delete), with three buttons at the lower right.

If there is no accelerator table defined, the editor will automatically start the 'Add' action, supposing you are not very interested in contemplating an empty list. The Add/Change dialog box edits a single line of the accelerator table.

Instead of showing here yet another screen shot, I think it is better to spend more time explaining the concepts behind this.

Each entry in the table consists of:
A numerical val
  • ue. This is the result of pressing the combination of keys.
  • An associated numerical identifier.
  • A set of flags that determine how the numerical value is interpreted.

  • You can define
either plain Ascii keys combinations, or you can set the 'Virtual Key' flag, that indicates to Windows that the value is to be interpreted as a value for a virtual key, i.e. a key like VK_F1, VK_BACK, etc. All those values are defined in <windows.h>, and they give the programmer a view of the keyboard that is independent from the type of keyboard that is used.

It is important to be clear that the ASCII/VIRTUAL KEY flags are alternatives (hence the radio buttons in the editor). You can only use one of those.

You can add flags specifying:
CONTROL: That flag means that the CONTROL key has to be pressed for the keys combination to be valid.
SHIFT: Ditto but with the key Shift.
ALT: The same for the Alt key.
NOINVERT: This means that the menu item associated with the same identifier should not be highlighted if it exists at all.

These flags are not alternatives, they can all be set for the same key combination. They can be set/unset using the checkboxes in the dialog box that edits each line of the table.

The accelerato
r resource is named following the same conventions as the naming of all other resource types: either with a character string or an identifier. You load the resource using the LoadAccelerators window function that searches for the specified accelerator table.
Table of contents
Mode of operation2 <\l >
Weditres is a utility for :2 <\l >
The different steps involved in the construction of a dialog box.2 <\l >
To use a dialog box you have to2 <\l >
The .rc files.3 <\l >
Structure of the generated code.3 <\l >
. some code here to treat this message3 <\l >
. some code here to treat this message3 <\l >
Building the dialog box.5 <\l >
A simple example5 <\l >
The .dlg file6 <\l >
BEGIN6 <\l >
END7 <\l >
A simple .rc file for our example7 <\l >
Configuring the preferences7 <\l >
Managing the selection8 <\l >
Testing your dialog box.8 <\l >
Using the directory listing8 <\l >
Setting the tab order.8 <\l >
Controlling which files get generated.9 <\l >
Group order11 <\l >
The toolbar12 <\l >
The selection13 <\l >
Fixing a control in the screen14 <\l >
The status bar14 <\l >
Managing the symbols15 <\l >
The zoom utility15 <\l >
‘’ This allows you to see in more detail your dialog box. Just choose zoom in the resources menu of Wedit, then click in the surface of the small window that appears. Then, without releasing the mouse button , move the mouse pointer around. You will see the magnified contents of the rectangle that the mouse draws in the zoom window.Properties of a dialog box15 <\l >
Properties of a dialog box16 <\l >
Title16 <\l >
Identity17 <\l >
 Font17 <\l >
Optional Gadgets17 <\l >
Standard buttons17 <\l >
Styles17 <\l >
 Messages19 <\l >
 Properties of a Push button20 <\l >
Properties of an edit field21 <\l >
Identity21 <\l >
 Text alignment21 <\l >
Styles21 <\l >
 Messages23 <\l >
 Radio button styles25 <\l >
Text25 <\l >
Identity25 <\l >
 Font25 <\l >
Messages25 <\l >
 Styles26 <\l >
 Static text styles27 <\l >
Text27 <\l >
Identity27 <\l >
 Font27 <\l >
Styles27 <\l >
 Properties of a ComboBox29 <\l >
Text29 <\l >
Identity29 <\l >
 Font29 <\l >
Styles29 <\l >
 Messages31 <\l >
 Properties of a List Box33 <\l >
Identity33 <\l >
 Font33 <\l >
Styles33 <\l >
 Messages35 <\l >
 Drag list box messages35 <\l >
Members36 <\l >
Check box Styles38 <\l >
Text38 <\l >
Identity38 <\l >
 Font38 <\l >
Initial state38 <\l >
Messages39 <\l >
 Styles39 <\l >
 Group box styles40 <\l >
White Rectangle styles41 <\l >
Black rectangle styles41 <\l >
Horizontal scroll42 <\l >
Vertical scroll styles42 <\l >
Spin control styles43 <\l >
Styles43 <\l >
 The tree control45 <\l >
Styles46 <\l >
 Messages :46 <\l >
1)NM_TREEVIEW47 <\l >
2)TV_ITEM47 <\l >
3)NMHDR48 <\l >
 Members description :48 <\l >
4)TV_DISPINFO :48 <\l >
Handling the Begin/End drag.49 <\l >
OK, that is the start. What about later ?49 <\l >
The slider control50 <\l >
The date calendar control52 <\l >
Processing the MCN_GETDAYSTATE Notification Message53 <\l >
Preparing the MONTHDAYSTATE Array53 <\l >
Processing this message within the framework.53 <\l >
The menu editor54 <\l >
The string table editor55 <\l >
The accelerator table editor56 <\l >
Table of contents58 <\l >


Resource Editor for Windows EXE and DLL Files: Resource Tuner.

Vu dans ... http://www.heaventools.com/resource-tuner.htm

Visual Resource Editor

Resource Tuner lets you view, extract, replace, edit, and delete the embedded resources of executable files: icons, strings, images, sounds, dialogs, menus - all that make up the visual part of your Windows programs.

Resource Editor screenshots In fact, it allows you to add your own custom branding to an application, change dialog messages, customize toolbar actions, and so on without having access to the actual source code. Resource Tuner offers exciting possibilities even if you aren't a programmer. It's perfect for translators, tweakers, and anyone else who wants a different look and feel for an application.

Resource Tuner is about the only tool you would probably trust to modify resources in a PE executable. Discover the unique features of this Resource Editor, including how to open problem executable files and edit the hidden data which the other editors simply cannot see, wide range of supported resource types, UPX unpacker, and more. You will learn the industry standard program for translating and customizing the user interface.

Resource Tuner is packed with features which make it an essential tool for anyone tweaking another programs. Have fun personalizing any application to your own unique taste. With the powerful Resource Tuner, you no longer need to suffer with ugly default icons and pictures. The usage is very simple, just run the program and then select the EXE or DLL file to read the data from. Once you try it, we think you will find it hard to go back to other resource hacking utilities.

Buying Choices:

Resource Tuner
Personal Use License

$49.95

Resource Tuner
Business Use License

$89.95

With Resource Tuner You Can

  • Have a fast Resource Viewer to browse resources of all types
  • Rebrand your applications by replacing icons and logos
  • Customize GUI elements of your favorite Windows programs
  • Translate third-party applications
  • Scan the directories and drives on your computer for hidden resources
  • Extract images, icons, sounds, animations
  • Make legacy applications use the new look of Windows
  • Tell Windows to run your application with administrative privileges
  • Open UPX-compressed files seamlessly in Resource Editor, without long workarounds

Feature List [image] Screenshots [image] What People Say About Resource Tuner

Step by Step Guide Showing You How to Open And Edit EXE And DLL Files

We Offer A Free Trial: Try The Software, Risk Free.

Download Resource Tuner Resource Tuner runs on all versions of Windows
from 2000 through XP, Vista, 7, 8 and 10.

Minimum hardware requirements:
Intel Pentium® or AMD K5 processor with 166 MHz
16 MB RAM

Customize Your Favorite Windows Programs

Longing to have a personal touch on your favorite application? No matter where it runs - whether on your PC or on your Pocket PC, on your Mobile Phone or on XBox, it is still a Windows program. What better way than with Resource Tuner, a resource editing solution you can use now. Quick and easy access to all the resources which are normally inaccessible really allows you completely customize any program you own.

Disappointed by older applications using the outdated "chiseled 3D" look, rather than the new Vista look? Resource Tuner's Manifest Wizard provides a quick fix. Bring your pre-XP legacy programs back to the future, blessing it instantly with the new look.

Resource Tuner makes it straightforward to translate any application, even if you do not have the source code for it, even if its original developers are long gone. Simply replace all text resources with their translated versions, and resize forms and buttons to fit the translated text as needed. No programming skills required!

More Options For Power Users

Resource Tuner is a PE Explorer spin-off product that is used solely to edit resources in Windows programs. PE Explorer is the choice for anyone looking for more. Includes a Resource Editor, Section Editor, Disassembler, Dependency Scanner and an Export/Import Viewer.


PE File Visual Resource Editor, Edit and Replace Resources in Windows EXE or DLL OCX SYS files.

Vu dans ... http://www.heaventools.com/rt-tour-resource-editor.htm

Visual Resource Editor

Add, edit and replace existing resources in your EXE or DLL files.

Resource Tuner lets you open Windows executable files such as .EXE, .DLL, Device Drivers (.SYS), ActiveX .OCX Controls, and several others. Once inside, you can change the look of the icons, cursors, dialogs, buttons, strings, sounds, animations and other elements of the Windows user interface by editing and replacing resources in the executable files.

Not all of those resources support direct editing, but for most you can replace and edit them. This would allow you, for instance, to add your own custom branding to an application, change dialog messages, customize toolbar actions, and so on without having access to the actual source code.

Support is provided for nearly every type of resources imaginable. Now you can read, view and replace large (256x256) PNG compressed Vista icons:

All changes made to resources can be watched on the screen and, if you are not satisfied with the result, you can return to the previous state. Any change you make can be restored prior to quitting the editor. You also have an option to create a backup copy of the target file (enabled by default). So by no means you can overwrite any important files.

Visual enviroment for editing dialogs

Depending on the resource type, the Resource Editor automatically starts the appropriate editor mode (Graphics, Dialog, Menu, DFM, Text, Media or Version Info), if one is available.

Resource Tuner allows you to edit the properties of controls on Delphi forms within the PE file. Because Resource Tuner has itself been written using Delphi, there's a very strong emphasis on peeking inside Delphi applications and packages.

Delphi form (DFM) Editor

If an editor mode is not available (for example, for a user-defined custom resource), Resource Tuner allows you to replace it anyway.

Replace Resource dialog

A command-line version of the resource editor is also available.

Feature Tour
prev | next

Order Now!
Give Resource Tuner a trial run for 30 days free! Once you try it, we think you will find it hard to go back to other resource hacking utilities. So if you decide to purchase it, it's only $49.95 for a Personal License. A Business license is available for $89.95.


Resource Builder - Visual Resource Editor for Windows

Vu dans ... http://www.resource-builder.com/

Resource Builder - Visual Resource Editor for Windows German version Russian version
English version German version Russian version

Resource Builder - the complete solution for resource editing!
Resource Builder- resource editor for Windows

Tired of editing resource files? Keen to speed-up and improve the editing of resources scripts or files?

Nowadays, resource files are used in almost all applications development, but resource editing has always been a difficult and non-trivial task. Using our Resource Builder, the resource editing becomes the easiest and fastest task in your programming cycle. Our resource editor will provide you with a lot of easy-to-use and user-friendly What You See Is What You Get (WYSIWYG) editors for each type of resource, and you will produce software even quicker than before. Full support for Windows Vista icons in icon resource editor brings you the most powerful resource editing tools for your projects.

Do you want to reduce development costs?

Most development tools (like Visual Studio and others) include resource compiler and resource editor only with expensive editions like Professional, Standard and others. Using Resource Builder among with cheap or even free (like Visual Studio Express) editions of development tools gives you the full power of advanced edition with minimal costs. As Resource Builder contains most user-friendly and intuitive interface developers will perform most resource editing tasks much faster and easily than using resource editors shipped with development tools. This lets you to reduce development time and as following the costs!

Do you need to support Unicode?

Resource Builder is a unique resource editor, which provides full support for Unicode. You can use Unicode resource scripts and Unicode data in your resources, and you will be able to edit them as easily as usual scripts.

Read more...

What's new in version 3.0 (November 12, 2008)?
 | Symbolic IDs support! Resource Builder now supports symbolic IDs in RC files.
 | Support for 64-bit executables! Resource Builder now suports 64-bit executable files like EXE, DLL and others.
 | Direct resource editing in executable files. Resource Builder allows to edit resources directly in executable files as they would in RC or RES projects.
 | Resource Explorer. Resource Builder includes integrated Resource Explorer which allows to browse, find and import resources stored on your drive or in executables using Windows Explorer-like user interface.
 | Span-lines in Dialog Editor. Resource Builder will display span-lines while user moves or resizes any control in Dialog Editor.
 | Serbian and Italian languages for Resource Builder UI. Resource Builder now includes Serbian and Italian languages integrated into user interface.
 | A lot of improvements made in resource compiler and other modules.

Click here to read the full version history

Resource Builder - full-featured resource editor for Windows that allows:

  • Visually edit RC and RES resource files using built-in visual editors with the unique full support of Unicode
  • Visually edit resources in EXE, DLL and other 32-bit as well as 64-bit exectable files (PE-files)
  • Patch, modify and update resources in executable modules such as EXE, DLL and other files (PE-files)
  • Import and explore resources in executable and other files files
  • Create resource-only DLLs (used for software localization) and many other powerful features
October 2005 - Resource Builder is featured in MSDN Magazine's New Stuff
If you need to build resource files for your applications, not just create icons and manage graphics, then Resource Builder is a resource management solution that includes multiple resource editors and a very fast compiler that supports all resource compiler (RC) format files. If you have to build resource files, Resource Builder is quite the workhorse.
Quick Info
OS: Windows 98 and later
Price: $59 (Buy now)
Trial Period: 30 days
Version: 3.0.3.25 (18 Sep 2009)
File Size: 4,205 K (Download now)
Articles
A quick look at Resource Builder
Pain-free Ability to Edit Resources
Using HTML resources to create user interface for your applications

Latest Version Screenshots
Full Support for Symbolic Defines! Integrated Resource Explorer
Main Window: with full support for Vista icons! | Text Editor
Menu Editor | Dialog Editor
Testimonials
" I must say that you've made a great program!" Dejan Milojevic, Serbia
"Resource Builder is one of the best programs in its class, a powerful solution for all resource-related tasks you need for the effective work." 3d2f.com Editorial Review
More testimonials...
Awards
Award cup Resource Builder has been awarded by many software sites. Check out the Awards page.
© 1999-2016 Igor Siticov, SiComponents® http://www.sicomponents.com
Resource Builder® and SiComponents® are registered trademarks of Igor Siticov.
Privacy SiteMap Terms


ResEdit Resource Editor - free resource editor for Win32

ResEdit Home Page

ResEdit is a resource editor for Windows programs. There are multiple ways to use it :

  • Software developers : Create you resource script (.rc) with dialogs, menu and then export it as an executable with ResEdit or use the generated script with your usual compiler.
  • Software translator : Open exe or dll file and directly translate the strings in dialogs, menu and string tables.
  • Other usages : Extract icons, bitmaps or any resource from 32-bit and 64-bit executables

Download

The current version of ResEdit is 1.6.6. You can download 32-bit or 64-bit version :

  • ResEdit-win32.7z
  • ResEdit-x64.7z

ResEdit changelog is available here.

You will need the Windows® Platform SDK to develop with ResEdit.

Donate

ResEdit is a freeware program. You can donate if you want to support ResEdit development.

Thank you in advance!

Our supporters

  • PELock Software Protection and License Key System

Screenshots

You will find some screenshots on this page

The Dialog Editor | The Menu Editor
The Dialog Editor | The Menu Editor
The StringTable Editor | Resource code preview
The StringTable Editor | Resource code preview

Documentation

ResEdit online documentation is available on this page.

Features

  • Importing rc files generated by Microsoft Visual Studio resource editor.
  • Supported formats : Resource Script (rc), Compiled Resource Script (res), Win32 Portable Executable (exe, dll).
  • Format conversion in command-line mode.
  • Advanced Dialog editor. All existing kind of Win32 controls are supported (Static text, Buttons, Edit controls, Pictures, ...).
  • A basic picture editor to open and modify bitmaps, icons and cursors
  • Possibility to include all sort of resources.
  • Generation of C++ code for the Dialogs (code with CreateWindowEx) and Menus (CreateMenu, CreatePopupMenu...). However it is not possible to import C++ sources files.
  • Unlimited Undo/Redo buffers
  • Customizable layout : you can drag and drop panels to place it wherever you want.

Translations

You can help me if you want to translate ResEdit into your language. This file contains all character strings which can be translated. To create a new language, you just have to begin a new column with your language name.

Please send me your txt ou modified xls file, even if your translation is incomplete. It will be released on this site.

Copyright © 2006-2017 | Contact


GDIView - View GDI handles/resources list and detect GDI leaks

GDIView v1.26 - View GDI handles/resources list and detect GDI leaks
Copyright (c) 2007 - 2016 Nir Sofer

See Also

  • RegFromApp - Generate RegEdit .reg file from Registry changes made by application.
  • RegDllView - View registered dll/ocx/exe files on your system
  • HeapMemView - View the content of memory blocks allocated for the heap of each process.
  • NK2Edit - Edit, merge and fix the AutoComplete files (.NK2) of Microsoft Outlook.

Description

GDIView is a unique tool that displays the list of GDI handles (brushes, pens, fonts, bitmaps, and others) opened by every process. It displays the total count for each type of GDI handle, as well as detailed information about each handle.
This tool can be useful for developers that need to trace GDI resources leak in their software.

System Requirements

This utility can work on Windows 2000, Windows XP, Windows Server 2003, Windows Vista, Windows 7/2008, Windows 8, and Windows 10. (Earlier versions of Windows are not supported). there is also x64 version available as a separated download.

Known Limitations

  • On 64-bit systems - GDIView cannot display extended information of 32-bit processes.

Versions History

  • Version 1.26:
    • Added 'Save All Items' menu item.
  • Version 1.25:
    • Added 2 new columns: 'Process Path' and 'Process User'.
    • Removed the wrong XML encoding from the XML files.
  • Version 1.20:
    • Added 'Run As Administrator' option (Ctrl+F11), which allows you to easily run GDIView as administrator on Windows Vista/7/8/2008.
  • Version 1.17:
    • Fixed bug: When selecting smss.exe with 'Display Handle Extended Information' option turned on, Windows crashed with a blue screen.
  • Version 1.16:
    • Added 'Auto Size Columns+Headers' option, which allows you to automatically resize the columns according to the row values and column headers.
    • Fixed issue: The properties dialog-box and other windows opened in the wrong monitor, on multi-monitors system.
  • Version 1.15:
    • Added 'Put Icon On Tray' option.
  • Version 1.10:
    • Added 'Detect Counter' column to the handles list in the lower pane. When handle is detected in the first time (new handle), this column displays '1'. This number is increased on every refresh that the same handle is still detected.
    • Added 'Detected On' column, which displays the date/time that the handle was first detcted.
    • Added 'Mark New Handle' option. When it's turned on, new detected handles (with Detect Counter = 1) are marked in pink color.
  • Version 1.06:
    • Fixed bug: On some Windows 7 systems, GDIView crashed the inspected process if the 'Display Handle Extended Information' was turned on.
  • Version 1.05:
    • Added 'GDI Total' column. (See the remark below)
  • Version 1.04:
    • Added sorting command-line options.
  • Version 1.03:
    • Fixed bug: The main window lost the focus when the user switched to another application and then returned back to GDIView.
  • Version 1.02:
    • Added option: Always On Top.
    • Added support for saving comma-delimited (.csv) files.
  • Version 1.01 - Fixed label size problems in 'Properties' and 'Choose Columns' windows.
  • Version 1.00 - First release.

Using GDIView

GDIView doesn't require any installation process or additional DLLs. Just copy the executable file (GDIView.exe) to any folder you like and run it.
The main window has 2 panes:
  • The upper pane displays the GDI handles count for each process.
  • The lower pane displays all GDI handles of the selected process in the upper pane.

The Upper Pane

The upper pane of GDIView displays counters of GDI handles for every process in your system.
You can view the counters in 3 modes:
  • Show Counters Only (F2): Displays only the total counters of GDI handles
  • Show Counters + Changes (F3): Displays the total counters of GDI handles, as well as the number of handles added (positive value) or released (negative value) since the last counters reset (F8).
  • Show Changes Only (F4): Displays the number of handles added (positive value) or released (negative value) since the last counters reset (F8).
The counters are updated according to the interval that you select in Options->Auto Refresh.

The Lower Pane

The lower pane of GDIView displays the details of all GDI handles of the selected process in the upper pane.
For each handle, the following information is displayed:
  • Handle: The handle value of the GDI resource.
  • Object Type: Bitmap, Brush, Pen, DC, and so on...
  • Kernel Address: The memory address in Windows Kernel that contains the data structure of this handle. Regular Windows application cannot read from this address, only device drivers can access it. However, you can view the content this memory by using WinDbg in kernel debugging mode.
  • Extended Information: Displays more information for brushes (color and style), pens (style/color/width), fonts (font name/width/height/weight), and bitmaps (width/height/bits per pixel).
    By default, displaying the extended information is disabled. You can enable it by selecting 'Display Handle Extended Information' from the Options menu. Be aware that extracting the extended information is more aggressive than the regular mode, so it's recommended to use it only when you really need it.

'GDI Total' and 'All GDI' columns

The 'GDI Total' column (a new column added on v1.05) displays the total number of all GDI handles found in the GDI table for the specified process. This means that 'GDI Total' column display the sum of the following columns: Pen, ExtPen, Brush, Bitmap, Font, Palette, Region, DC, Metafile DC, Enhanced Metafile DC, and Other GDI.
The 'All GDI' value is taken from Windows API call (GetGuiResources), and it usually contains a value larger than 'GDI Total', probably because it also counts some internal kernel GDI objects that are not included in the GDI objects table of the process.

Notice: If you have a problem that the 'All GDI' value is increased, while there is no leak with the other GDI values, it means that you probably have a leak in the creation of icons or cursors (Icons and cursors are created without destroying them later).

Command-Line Options

/stext <Filename> | Save the list of all GDI counters into a regular text file.
/stab <Filename> | Save the list of all GDI counters into a tab-delimited text file.
/scomma <Filename> | Save the list of all GDI counters into a comma-delimited text file.
/stabular <Filename> | Save the list of all GDI counters into a tabular text file.
/shtml <Filename> | Save the list of all GDI counters into HTML file (Horizontal).
/sverhtml <Filename> | Save the list of all GDI counters into HTML file (Vertical).
/sxml <Filename> | Save the list of all GDI counters to XML file.
/sort <column> | This command-line option can be used with other save options for sorting by the desired column. If you don't specify this option, the list is sorted according to the last sort that you made from the user interface. The <column> parameter can specify the column index (0 for the first column, 1 for the second column, and so on) or the name of the column, like "Pen" and "Brush". You can specify the '~' prefix character (e.g: "~All GDI") if you want to sort in descending order. You can put multiple /sort in the command-line if you want to sort by multiple columns. Examples: GDIView.exe /shtml "f:\temp\gdi.html" /sort 2 /sort ~1 GDIView.exe /shtml "f:\temp\gdi.html" /sort "~Pen"
/nosort | When you specify this command-line option, the list will be saved without any sorting.

Translating GDIView to other languages

In order to translate GDIView to other language, follow the instructions below:
  1. Run GDIView with /savelangfile parameter:
    GDIView.exe /savelangfile
    A file named GDIView_lng.ini will be created in the folder of GDIView utility.
  2. Open the created language file in Notepad or in any other text editor.
  3. Translate all string entries to the desired language. Optionally, you can also add your name and/or a link to your Web site. (TranslatorName and TranslatorURL values) If you add this information, it'll be used in the 'About' window.
  4. After you finish the translation, Run GDIView, and all translated strings will be loaded from the language file.
    If you want to run GDIView without the translation, simply rename the language file, or move it to another folder.

License

This utility is released as freeware. You are allowed to freely distribute this utility via floppy disk, CD-ROM, Internet, or in any other way, as long as you don't charge anything for this. If you distribute this utility, you must include all files in the distribution package, without any modification !

Disclaimer

The software is provided "AS IS" without any warranty, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The author will not be liable for any special, incidental, consequential or indirect damages due to loss of data or any other reason.

Feedback

If you have any problem, suggestion, comment, or you found a bug in my utility, you can send a message to nirsofer@yahoo.com
Download GDIView
Download GDIView - x64 release

GDIView is also available in other languages. In order to change the language of GDIView, download the appropriate language zip file, extract the 'gdiview_lng.ini', and put it in the same folder that you Installed GDIView utility.

Language | Translated By | Date | Version
Dutch | Jan Verheijen | 07/12/2016 | 1.26
French | J�r�mie Roquet (Arkanosis) | 18/08/2007 |
German | �Latino� auf WinTotal.de | 05/12/2016 | 1.26
Greek | geogeo.gr | 01/07/2017 | 1.26
Italian |  | 25/01/2013 |
Romanian | Jaff (Oprea Nicolae) | 22/11/2015 | 1.25
Russian | Dmitry Yerokhin | 05/12/2016 | 1.26
Russian | Oleg Luty | 26/02/2011 |
Simplified Chinese | Cye3s | 20/11/2007 |
Spanish | arquer.net | 05/12/2010 |
Traditional Chinese | Danfong Hsieh | 11/12/2016 |
Thai | �ѡ��� ����ó�ҵ�� | 28/03/2008 |
Turkish | Serta� Aky�z | 01/03/2009 |
Valencian | vjatv | 24/05/2010 |


Exemple

--- Ensemble des Ressources dans file.RC

2002 AVI "setup.avi"

701 PNGFILE "Res\Data_3.bin"
702 PNGFILE "Res\Data_3.png"

TEXT

WAVE

DATA

110 ICON "Icon_1.ico"

511 BITMAP Bmp_1.bmp

500 CURSOR

512 FONT "Conman Regular.ttf"

1010 RCDATA
{
0x123
"bonjour"
}

1020 IMAGE Bmp_5.bmp

1030 TEXT "DOC.txt"

1040 METAFILE "metal.WMF"

STRINGTABLE
{
21 "Bonjour"
22 "Au revoir"
}

MESSAGETABLE vu dans RTF Borland

512 FONT "Conman Regular.ttf"

1010 RCDATA
{
5
40
0x123
"bonjour"
}

1020 IMAGE Bmp_5.bmp

1030 TEXT "DOC.txt"
BB1 TEXT "Bach1.mid"

1040 METAFILE "metal.WMF"

1050 WAV "C:\dollar.wav"

STRINGTABLE
{
21 "Bonjour"
22 "Au revoir"
}


Button state values

Value | Meaning
0x0003 | Specifies the check state (radio buttons and check boxes only). A value of BST_UNCHECKED indicates the button is cleared; a value of BST_CHECKED indicates the button is checked. A radio button is checked when it contains a dot; a check box is checked when it contains an X. A value of BST_INDETERMINATE indicates the check state is indeterminate (applies only if the button has the BS_3STATE or BS_AUTO3STATE style). A three-state check box is grayed when its state is indeterminate.
BST_CHECKED | Indicates the button is checked.
BST_FOCUS | Specifies the focus state. A nonzero value indicates that the button has the keyboard focus.
BST_INDETERMINATE | Indicates the button is grayed because the state of the button is indeterminate. This value applies only if the button has the BS_3STATE or BS_AUTO3STATE style.
BST_PUSHED | Specifies the highlight state. A nonzero value indicates that the button is highlighted. A button is automatically highlighted when the user positions the cursor over it and presses and holds the left mouse button. The highlighting is removed when the user releases the mouse button.
BST_UNCHECKED | Indicates the button is cleared. Same as a return value of zero.


Button Styles

If you create a button by specifying the BUTTON class with the CreateWindow or CreateWindowEx function, you can specify a combination of the following button styles.

Constants

BS_3STATE
Creates a button that is the same as a check box, except that the box can be grayed as well as checked or cleared. Use the grayed state to show that the state of the check box is not determined.

BS_AUTO3STATE
Creates a button that is the same as a three-state check box, except that the box changes its state when the user selects it. The state cycles through checked, grayed, and cleared.

BS_AUTOCHECKBOX
Creates a button that is the same as a check box, except that the check state automatically toggles between checked and cleared each time the user selects the check box.

BS_AUTORADIOBUTTON
Creates a button that is the same as a radio button, except that when the user selects it, The system automatically sets the button's check state to checked and automatically sets the check state for all other buttons in the same group to cleared.

BS_CHECKBOX
Creates a small, empty check box with text. By default, the text is displayed to the right of the check box. To display the text to the left of the check box, combine this flag with the BS_LEFTTEXT style (or with the equivalent BS_RIGHTBUTTON style).

BS_DEFPUSHBUTTON
Creates a push button that behaves like a BS_PUSHBUTTON style button, but also has a heavy black border. If the button is in a dialog box, the user can select the button by pressing the ENTER key, even when the button does not have the input focus. This style is useful for enabling the user to quickly select the most likely (default) option.

BS_GROUPBOX
Creates a rectangle in which other controls can be grouped. Any text associated with this style is displayed in the rectangle's upper left corner.

BS_LEFTTEXT
Places text on the left side of the radio button or check box when combined with a radio button or check box style. Same as the BS_RIGHTBUTTON style.

BS_OWNERDRAW
Creates an owner-drawn button. The owner window receives a WM_DRAWITEM message when a visual aspect of the button has changed. Do not combine the BS_OWNERDRAW style with any other button styles.

BS_PUSHBUTTON
Creates a push button that posts a WM_COMMAND message to the owner window when the user selects the button.

BS_RADIOBUTTON
Creates a small circle with text. By default, the text is displayed to the right of the circle. To display the text to the left of the circle, combine this flag with the BS_LEFTTEXT style (or with the equivalent BS_RIGHTBUTTON style). Use radio buttons for groups of related, but mutually exclusive choices.

BS_USERBUTTON
Obsolete, but provided for compatibility with 16-bit versions of Windows. Applications should use BS_OWNERDRAW instead.

BS_BITMAP
Specifies that the button displays a bitmap.

BS_BOTTOM
Places text at the bottom of the button rectangle.

BS_CENTER
Centers text horizontally in the button rectangle.

BS_ICON
Specifies that the button displays an icon.

BS_FLAT
Specifies that the button is two-dimensional; it does not use the default shading to create a 3-D image.

BS_LEFT
Left-justifies the text in the button rectangle. However, if the button is a check box or radio button that does not have the BS_RIGHTBUTTON style, the text is left justified on the right side of the check box or radio button.

BS_MULTILINE
Wraps the button text to multiple lines if the text string is too long to fit on a single line in the button rectangle.

BS_NOTIFY
Enables a button to send BN_KILLFOCUS and BN_SETFOCUS notification messages to its parent window.

Note that buttons send the BN_CLICKED notification message regardless of whether it has this style. To get BN_DBLCLK notification messages, the button must have the BS_RADIOBUTTON or BS_OWNERDRAW style.

BS_PUSHLIKE
Makes a button (such as a check box, three-state check box, or radio button) look and act like a push button. The button looks raised when it isn't pushed or checked, and sunken when it is pushed or checked.

BS_RIGHT
Right-justifies text in the button rectangle. However, if the button is a check box or radio button that does not have the BS_RIGHTBUTTON style, the text is right justified on the right side of the check box or radio button.

BS_RIGHTBUTTON
Positions a radio button's circle or a check box's square on the right side of the button rectangle. Same as the BS_LEFTTEXT style.

BS_TEXT
Specifies that the button displays text.

BS_TOP
Places text at the top of the button rectangle.

BS_TYPEMASK
Microsoft® Windows® 2000: A composite style bit that results from using the OR operator on BS_* style bits. It can be used to mask out valid BS_* bits from a given bitmask. Note that this is out of date and does not correctly include all valid styles. Thus, you should not use this style.

BS_VCENTER
Places text in the middle (vertically) of the button rectangle.


Check Boxes

A check box consists of a square box and application-defined text (label), an icon, or a bitmap, that indicates a choice the user can make by selecting the button. Applications typically display check boxes in a group box to permit the user to choose from a set of related, but independent options. For example, an application might present a group of check boxes from which the user can select error conditions that produce warning beeps.

A check box can be one of four styles: standard, automatic, three-state, and automatic three-state, as defined by the constants BS_CHECKBOX, BS_AUTOCHECKBOX, BS_3STATE, and BS_AUTO3STATE, respectively. Each style can assume two check states: checked (a check mark inside the box) or cleared (no check mark). In addition, a three-state check box can assume an indeterminate state (a grayed box inside the check box). Repeatedly clicking a standard or automatic check box toggles it from checked to cleared and back again. Repeatedly clicking a three-state check box toggles it from checked to cleared to indeterminate and back again.

When the user clicks a check box (of any style), the check box receives the keyboard focus. The system sends the check box's parent window a WM_COMMAND message containing the BN_CLICKED notification code. The parent window doesn't acknowledge this message if it comes from an automatic check box or automatic three-state check box, because the system automatically sets the check state for those styles. But the parent window must acknowledge the message if it comes from a check box or three-state check box because the parent window is responsible for setting the check state for those styles. Regardless of the check box style, the system automatically repaints the check box once its state is changed.


Combo Box Styles

To create a combo box using the CreateWindow or CreateWindowEx function, specify the COMBOBOX class, appropriate window style constants, and a combination of the following combo box styles.

Constants

CBS_AUTOHSCROLL
Automatically scrolls the text in an edit control to the right when the user types a character at the end of the line. If this style is not set, only text that fits within the rectangular boundary is allowed.

CBS_DISABLENOSCROLL
Shows a disabled vertical scroll bar in the list box when the box does not contain enough items to scroll. Without this style, the scroll bar is hidden when the list box does not contain enough items.

CBS_DROPDOWN
Similar to CBS_SIMPLE, except that the list box is not displayed unless the user selects an icon next to the edit control.

CBS_DROPDOWNLIST
Similar to CBS_DROPDOWN, except that the edit control is replaced by a static text item that displays the current selection in the list box.

CBS_HASSTRINGS
Specifies that an owner-drawn combo box contains items consisting of strings. The combo box maintains the memory and address for the strings so the application can use the CB_GETLBTEXT message to retrieve the text for a particular item.

For accessibility issues, see Exposing Owner-Drawn Combo Box Items

CBS_LOWERCASE
Converts to lowercase all text in both the selection field and the list.

CBS_NOINTEGRALHEIGHT
Specifies that the size of the combo box is exactly the size specified by the application when it created the combo box. Normally, the system sizes a combo box so that it does not display partial items.

CBS_OEMCONVERT
Converts text entered in the combo box edit control from the Windows character set to the OEM character set and then back to the Windows character set. This ensures proper character conversion when the application calls the CharToOem function to convert a Windows string in the combo box to OEM characters. This style is most useful for combo boxes that contain file names and applies only to combo boxes created with the CBS_SIMPLE or CBS_DROPDOWN style.

CBS_OWNERDRAWFIXED
Specifies that the owner of the list box is responsible for drawing its contents and that the items in the list box are all the same height. The owner window receives a WM_MEASUREITEM message when the combo box is created and a WM_DRAWITEM message when a visual aspect of the combo box has changed.

CBS_OWNERDRAWVARIABLE
Specifies that the owner of the list box is responsible for drawing its contents and that the items in the list box are variable in height. The owner window receives a WM_MEASUREITEM message for each item in the combo box when you create the combo box and a WM_DRAWITEM message when a visual aspect of the combo box has changed.

CBS_SIMPLE
Displays the list box at all times. The current selection in the list box is displayed in the edit control.

CBS_SORT
Automatically sorts strings added to the list box.

CBS_UPPERCASE
Converts to uppercase all text in both the selection field and the list.


Edit Control Styles

To create an edit control using the CreateWindow or CreateWindowEx function, specify the EDIT class, appropriate window style constants, and a combination of the following edit control styles. After the control has been created, these styles cannot be modified, except as noted.

Constants

ES_AUTOHSCROLL
Automatically scrolls text to the right by 10 characters when the user types a character at the end of the line. When the user presses the ENTER key, the control scrolls all text back to position zero.

ES_AUTOVSCROLL
Automatically scrolls text up one page when the user presses the ENTER key on the last line.

ES_CENTER
Windows 98/Me, Windows 2000/XP: Centers text in a single-line or multiline edit control.

Windows 95, Windows NT 4.0 and earlier: Centers text in a multiline edit control.

ES_LEFT
Left aligns text.

ES_LOWERCASE
Converts all characters to lowercase as they are typed into the edit control.

To change this style after the control has been created, use SetWindowLong .

ES_MULTILINE
Designates a multiline edit control. The default is single-line edit control.

When the multiline edit control is in a dialog box, the default response to pressing the ENTER key is to activate the default button. To use the ENTER key as a carriage return, use the ES_WANTRETURN style.

When the multiline edit control is not in a dialog box and the ES_AUTOVSCROLL style is specified, the edit control shows as many lines as possible and scrolls vertically when the user presses the ENTER key. If you do not specify ES_AUTOVSCROLL, the edit control shows as many lines as possible and beeps if the user presses the ENTER key when no more lines can be displayed.

If you specify the ES_AUTOHSCROLL style, the multiline edit control automatically scrolls horizontally when the caret goes past the right edge of the control. To start a new line, the user must press the ENTER key. If you do not specify ES_AUTOHSCROLL, the control automatically wraps words to the beginning of the next line when necessary. A new line is also started if the user presses the ENTER key. The window size determines the position of the Wordwrap. If the window size changes, the Wordwrapping position changes and the text is redisplayed.

Multiline edit controls can have scroll bars. An edit control with scroll bars processes its own scroll bar messages. Note that edit controls without scroll bars scroll as described in the previous paragraphs and process any scroll messages sent by the parent window.

ES_NOHIDESEL
Negates the default behavior for an edit control. The default behavior hides the selection when the control loses the input focus and inverts the selection when the control receives the input focus. If you specify ES_NOHIDESEL, the selected text is inverted, even if the control does not have the focus.

ES_NUMBER
Allows only digits to be entered into the edit control. Note that, even with this set, it is still possible to paste non-digits into the edit control.

To change this style after the control has been created, use SetWindowLong.

ES_OEMCONVERT
Converts text entered in the edit control. The text is converted from the Windows character set to the OEM character set and then back to the Windows character set. This ensures proper character conversion when the application calls the CharToOem function to convert a Windows string in the edit control to OEM characters. This style is most useful for edit controls that contain file names.

To change this style after the control has been created, use SetWindowLong.

ES_PASSWORD
Displays an asterisk (*) for each character typed into the edit control. This style is valid only for single-line edit controls.

Windows XP: If the edit control is from user32.dll, the default password character is an asterisk. However, if the edit control is from comctl32.dll version 6, the default character is a black circle.

To change the characters that is displayed, or set or clear this style, use the EM_SETPASSWORDCHAR message.

Note Comctl32.dll version 6 is not redistributable but it is included in Microsoft® Windows® XP or later. To use Comctl32.dll version 6, specify it in a manifest. For more information on manifests, see Using Windows XP Visual Styles .

ES_READONLY
Prevents the user from typing or editing text in the edit control.

To change this style after the control has been created, use the EM_SETREADONLY message.

ES_RIGHT
Windows 98/Me, Windows 2000/XP: Right aligns text in a single-line or multiline edit control. Windows 95, Windows NT 4.0 and earlier: Right aligns text in a multiline edit control.

ES_UPPERCASE
Converts all characters to uppercase as they are typed into the edit control.

To change this style after the control has been created, use SetWindowLong.

ES_WANTRETURN
Specifies that a carriage return be inserted when the user presses the ENTER key while entering text into a multiline edit control in a dialog box. If you do not specify this style, pressing the ENTER key has the same effect as pressing the dialog box's default push button. This style has no effect on a single-line edit control.

To change this style after the control has been created, use SetWindowLong.


Group Boxes

A group box is a rectangle that surrounds a set of controls, such as check boxes or radio buttons, with application-defined text (label) in its upper left corner. The sole purpose of a group box is to organize controls related by a common purpose (usually indicated by the label). The group box has only one style, defined by the constant BS_GROUPBOX. Because a group box cannot be selected, it has no check state, focus state, or push state. An application cannot send messages to a group box.


List Box Styles

To create a list box by using the CreateWindow or CreateWindowEx function, use the LISTBOX class, appropriate window style constants, and the following style constants to define the list box. After the control has been created, these styles cannot be modified, except as noted.

LBS_COMBOBOX
Notifies a list box that it is part of a combo box.

LBS_DISABLENOSCROLL
Shows a disabled vertical scroll bar for the list box when the box does not contain enough items to scroll. If you do not specify this style, the scroll bar is hidden when the list box does not contain enough items.

LBS_EXTENDEDSEL
Allows multiple items to be selected by using the SHIFT key and the mouse or special key combinations.

LBS_HASSTRINGS
Specifies that a list box contains items consisting of strings. The list box maintains the memory and addresses for the strings so that the application can use the LB_GETTEXT message to retrieve the text for a particular item. By default, all list boxes except owner-drawn list boxes have this style. You can create an owner-drawn list box either with or without this style.

LBS_MULTICOLUMN
Specifies amulti columnn list box that is scrolled horizontally. The LB_SETCOLUMNWIDTH message sets the width of the columns.

LBS_MULTIPLESEL
Turns string selection on or off each time the user clicks or double-clicks a string in the list box. The user can select any number of strings.

LBS_NODATA
Specifies a no-data list box. Specify this style when the count of items in the list box will exceed one thousand. A no-data list box must also have the LBS_OWNERDRAWFIXED style, but must not have the LBS_SORT or LBS_HASSTRINGS style.

A no-data list box resembles an owner-drawn list box except that it contains no string or bitmap data for an item. Commands to add, insert, or delete an item always ignore any specified item data; requests to find a string within the list box always fail. The system sends the WM_DRAWITEM message to the owner window when an item must be drawn. The itemID member of the DRAWITEMSTRUCT structure passed with the WM_DRAWITEM message specifies the line number of the item to be drawn. A no-data list box does not send a WM_DELETEITEM message.

LBS_NOINTEGRALHEIGHT
Specifies that the size of the list box is exactly the size specified by the application when it created the list box. Normally, the system sizes a list box so that the list box does not display partial items.

LBS_NOREDRAW
Specifies that the list box's appearance is not updated when changes are made.

To change the redraw state of the control, use the WM_SETREDRAW message.

LBS_NOSEL
Specifies that the list box contains items that can be viewed but not selected.

LBS_NOTIFY
Notifies the parent window with an input message whenever the user clicks or double-clicks a string in the list box.

LBS_OWNERDRAWFIXED
Specifies that the owner of the list box is responsible for drawing its contents and that the items in the list box are the same height. The owner window receives a WM_MEASUREITEM message when the list box is created and a WM_DRAWITEM message when a visual aspect of the list box has changed.

LBS_OWNERDRAWVARIABLE
Specifies that the owner of the list box is responsible for drawing its contents and that the items in the list box are variable in height. The owner window receives a WM_MEASUREITEM message for each item in the combo box when the combo box is created and a WM_DRAWITEM message when a visual aspect of the combo box has changed.

LBS_SORT
Sorts strings in the list box alphabetically.

LBS_STANDARD
Sorts strings in the list box alphabetically. The parent window receives an input message whenever the user clicks or double-clicks a string. The list box has borders on all sides.

LBS_USETABSTOPS
Enables a list box to recognize and expand tab characters when drawing its strings. You can use the LB_SETTABSTOPS message to specify tab stop positions. The default tab positions are 32 dialog template units apart. Dialog template units are the device-independent units used in dialog box templates. To convert measurements from dialog template units to screen units (pixels), use the MapDialogRect function.

LBS_WANTKEYBOARDINPUT
Specifies that the owner of the list box receives WM_VKEYTOITEM messages whenever the user presses a key and the list box has the input focus. This enables an application to perform special processing on the keyboard input.


Owner

Owner-Drawn Buttons

Unlike radio buttons, an owner-drawn button is painted by the application, not by the system, and has no predefined appearance or usage. Its purpose is to provide a button whose appearance and behavior are defined by the application alone. There is only one owner-drawn button style: BS_OWNERDRAW.

When the user selects an owner-drawn button, the system sends the button's parent window a WM_COMMAND message containing the BN_CLICKED notification code, just as it does for a button that is not owner-drawn. The application must respond appropriately.

For an example of an owner-drawn button, see Using Owner-Drawn Buttons.


Push Buttons

A push button is a rectangle containing application-defined text (label), an icon, or a bitmap that indicates what the button does when the user selects it. A push button can be one of two styles: standard or default, as defined by the constants BS_PUSHBUTTON and BS_DEFPUSHBUTTON. A standard push button is typically used to start an operation. It receives the keyboard focus when the user clicks it. A default push button, on the other hand, is typically used to indicate the most common or default choice. It is a button that the user can select by simply pressing ENTER when a dialog box has the input focus.

When the user clicks a push button (of either style), it receives the keyboard focus. The system sends the button's parent window a WM_COMMAND message that contains the BN_CLICKED notification code. In response, the dialog box typically closes and carries out the operation indicated by the button.

The default push button cannot be a check box, a radio button, or an ownerdraw button at the same time.


Radio Buttons

A radio button consists of a round button and application-defined text (a label), an icon, or a bitmap that indicates a choice the user can make by selecting the button. An application typically uses radio buttons in a group box to permit the user to choose from a set of related, but mutually exclusive options. For example, the application might present a group of radio buttons from which the user can select a format preference for text selected in the client area. The user could select a left-aligned, right-aligned, or centered format by selecting the corresponding radio button. Typically, the user can select only one option at a time from a set of radio buttons.

A radio button can be one of two styles: standard or automatic, as defined by the constants BS_RADIOBUTTON and BS_AUTORADIOBUTTON. Each style can assume two check states: checked (a dot in the button) or cleared (no dot in the button). Repeatedly selecting a radio button (standard or automatic) toggles it from checked to cleared and back again.

When the user selects either state, the radio button receives the keyboard focus. The system sends the button's parent window a WM_COMMAND message containing the BN_CLICKED notification code. The parent window doesn't acknowledge this message if it comes from an automatic radio button because the system automatically sets the check state for that style. But the parent window should acknowledge the message if it comes from a radio button because the parent window is responsible for setting the check state for that style. Regardless of the radio button style, the system automatically repaints the button as its state changes.

When the user selects an automatic radio button, the system automatically sets the check state of all other radio buttons within the same group to cleared. The same behavior is available for standard radio buttons by using the WS_GROUP style, as discussed in Dialog Boxes.